summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authorcweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-10-03 14:00:33 +0000
committercweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-10-03 14:00:33 +0000
commit29422fa55379aa61a61019b832c83dab6d450264 (patch)
treee5884ce6fed2cf1d02165a1b5667b99cd80262e5 /www
parentb8b1d06b2d899658fae64d0de506439ca0ea067c (diff)
downloadsemanticscuttle-29422fa55379aa61a61019b832c83dab6d450264.tar.gz
semanticscuttle-29422fa55379aa61a61019b832c83dab6d450264.tar.bz2
move files to new locations
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@386 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'www')
-rw-r--r--www/about.php27
-rw-r--r--www/admin.php94
-rw-r--r--www/ajax/getadminlinkedtags.php64
-rw-r--r--www/ajax/getadmintags.php44
-rw-r--r--www/ajax/getcontacttags.php44
-rw-r--r--www/ajax/getlinkedtags.php64
-rw-r--r--www/ajax/gettags.php44
-rw-r--r--www/ajaxDelete.php48
-rw-r--r--www/ajaxGetTitle.php73
-rw-r--r--www/ajaxIsAvailable.php44
-rw-r--r--www/alltags.php87
-rw-r--r--www/api/export_csv.php47
-rw-r--r--www/api/export_gcs.php66
-rw-r--r--www/api/export_html.php54
-rw-r--r--www/api/export_sioc.php90
-rw-r--r--www/api/httpauth.inc.php33
-rw-r--r--www/api/opensearch.php18
-rw-r--r--www/api/posts_add.php83
-rw-r--r--www/api/posts_all.php48
-rw-r--r--www/api/posts_dates.php40
-rw-r--r--www/api/posts_delete.php34
-rw-r--r--www/api/posts_get.php61
-rw-r--r--www/api/posts_public.php48
-rw-r--r--www/api/posts_recent.php62
-rw-r--r--www/api/posts_update.php25
-rw-r--r--www/api/tags_get.php26
-rw-r--r--www/api/tags_rename.php37
-rw-r--r--www/bookmarkcommondescriptionedit.php78
-rw-r--r--www/bookmarks.php292
-rw-r--r--www/edit.php121
-rw-r--r--www/gsearch/context.php27
-rw-r--r--www/gsearch/index.php45
-rw-r--r--www/history.php93
-rw-r--r--www/icon.pngbin0 -> 771 bytes
-rw-r--r--www/images/b_edit.pngbin0 -> 451 bytes
-rw-r--r--www/images/bg_admin.pngbin0 -> 1212 bytes
-rw-r--r--www/images/bg_bar.pngbin0 -> 873 bytes
-rw-r--r--www/images/bg_header.pngbin0 -> 684 bytes
-rw-r--r--www/images/bg_sidebar.pngbin0 -> 726 bytes
-rw-r--r--www/images/loading.gifbin0 -> 1582 bytes
-rw-r--r--www/images/logo.pngbin0 -> 2973 bytes
-rw-r--r--www/images/logo_24.gifbin0 -> 1530 bytes
-rw-r--r--www/images/rss.gifbin0 -> 401 bytes
-rw-r--r--www/import.php116
-rw-r--r--www/importNetscape.php126
-rw-r--r--www/importStructure.php76
-rw-r--r--www/index.php99
-rw-r--r--www/js/MultiComboBox.js72
-rw-r--r--www/jsScuttle.php148
-rw-r--r--www/login.php62
-rw-r--r--www/password.php78
-rw-r--r--www/player/error.swfbin0 -> 90 bytes
-rw-r--r--www/player/license.txt10
-rw-r--r--www/player/load.swfbin0 -> 311 bytes
-rw-r--r--www/player/musicplayer_f6.swfbin0 -> 6463 bytes
-rw-r--r--www/player/play.swfbin0 -> 73 bytes
-rw-r--r--www/player/stop.swfbin0 -> 77 bytes
-rw-r--r--www/populartags.php84
-rw-r--r--www/profile.php129
-rw-r--r--www/register.php80
-rw-r--r--www/rss.php121
-rw-r--r--www/scuttle.css571
-rw-r--r--www/search.php136
-rw-r--r--www/tag2tagadd.php69
-rw-r--r--www/tag2tagdelete.php85
-rw-r--r--www/tag2tagedit.php60
-rw-r--r--www/tagcommondescriptionedit.php71
-rw-r--r--www/tagdelete.php58
-rw-r--r--www/tagedit.php68
-rw-r--r--www/tagrename.php78
-rw-r--r--www/tags.php103
-rw-r--r--www/upgrade.php61
-rw-r--r--www/users.php62
-rw-r--r--www/watch.php61
-rw-r--r--www/watchlist.php128
-rw-r--r--www/widgetUWA.php234
76 files changed, 5107 insertions, 0 deletions
diff --git a/www/about.php b/www/about.php
new file mode 100644
index 0000000..878e7e5
--- /dev/null
+++ b/www/about.php
@@ -0,0 +1,27 @@
+<?php
+/***************************************************************************
+ Copyright (C) 2004, 2005 Scuttle project
+ http://sourceforge.net/projects/scuttle/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ ***************************************************************************/
+
+require_once('header.inc.php');
+
+$tplVars['pagetitle'] = T_('About');
+$tplVars['subtitle'] = T_('About');
+
+$templateservice->loadTemplate('about.tpl', $tplVars);
+?> \ No newline at end of file
diff --git a/www/admin.php b/www/admin.php
new file mode 100644
index 0000000..b57b568
--- /dev/null
+++ b/www/admin.php
@@ -0,0 +1,94 @@
+<?php
+/***************************************************************************
+ Copyright (C) 2007 - 2008 SemanticScuttle project (fork from Scuttle)
+ http://sourceforge.net/projects/semanticscuttle/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ ***************************************************************************/
+
+require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
+$bookmark2tagservice = & ServiceFactory :: getServiceInstance('Bookmark2Tagservice');
+$bookmarkservice = & ServiceFactory :: getServiceInstance('BookmarkService');
+$tag2tagservice = & ServiceFactory :: getServiceInstance('Tag2TagService');
+$tagcacheservice = & ServiceFactory :: getServiceInstance('TagCacheService');
+$commondescriptionservice = & ServiceFactory :: getServiceInstance('CommonDescriptionService');
+$searchhistoryservice = & ServiceFactory :: getServiceInstance('SearchHistoryService');
+$tagstatservice = & ServiceFactory :: getServiceInstance('TagStatService');
+
+// Header variables
+$tplVars['subtitle'] = T_('Manage users');
+$tplVars['loadjs'] = true;
+$tplVars['sidebar_blocks'] = array('users' );
+$tplVars['error'] = '';
+$tplVars['msg'] = '';
+
+if ( !$userservice->isLoggedOn() ) {
+ header('Location: '. createURL('login', ''));
+ exit();
+}
+
+if ( !$currentUser->isAdmin() ) {
+ header('Location: '. createURL('bookmarks', $currentUser->getUsername()));
+ exit();
+}
+
+@list($url, $action, $user) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL;
+
+if ( $action
+&& (strpos($_SERVER['HTTP_REFERER'], ROOT.'admin') === 0) // Prevent CSRF attacks
+) {
+ switch ( $action ) {
+ case 'delete':
+ if ( $user && ($userinfo = $userservice->getUserByUsername($user)) ) {
+ $uId = $userinfo['uId'];
+
+ $tagcacheservice->deleteByUser($uId);
+ $tag2tagservice->removeLinkedTagsForUser($uId);
+ $userservice->deleteUser($uId);
+ $bookmark2tagservice->deleteTagsForUser($uId);
+ $commondescriptionservice->deleteDescriptionsForUser($uId);
+ $searchhistoryservice->deleteSearchHistoryForUser($uId);
+ $tagstatservice->deleteTagStatForUser($uId);
+ // XXX: don't delete bookmarks before tags, else tags can't be deleted !!!
+ $bookmarkservice->deleteBookmarksForUser($uId);
+
+ $tplVars['msg'] = sprintf(T_('%s and all his bookmarks and tags were deleted.'), $user);
+ }
+ break;
+ case 'checkUrl' :
+ $bookmarks =& $bookmarkservice->getBookmarks(0, NULL, NULL, NULL, NULL, getSortOrder());
+ foreach($bookmarks['bookmarks'] as $bookmark) {
+ if(!checkUrl($bookmark['bAddress'])) {
+ $tplVars['error'].= T_('Problem with ').$bookmark['bAddress'].' ('. $bookmark['username'] .')<br/>';
+ }
+ }
+ break;
+ default:
+ // DO NOTHING
+ }
+}
+
+$templatename = 'admin.tpl';
+$users =& $userservice->getObjectUsers();
+
+if ( !is_array($users) ) {
+ $users = array();
+}
+
+$tplVars['users'] =& $users;
+
+$templateservice->loadTemplate($templatename, $tplVars);
+?>
diff --git a/www/ajax/getadminlinkedtags.php b/www/ajax/getadminlinkedtags.php
new file mode 100644
index 0000000..75aae9a
--- /dev/null
+++ b/www/ajax/getadminlinkedtags.php
@@ -0,0 +1,64 @@
+<?php
+/***************************************************************************
+ Copyright (C) 2004 - 2006 Scuttle project
+ http://sourceforge.net/projects/scuttle/
+ http://scuttle.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ ***************************************************************************/
+
+/* Return a json file with list of linked tags */
+
+require_once('../header.inc.php');
+
+/* Service creation: only useful services are created */
+$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
+$bookmarkservice =& ServiceFactory::getServiceInstance('TagService');
+$tagstatservice =& ServiceFactory::getServiceInstance('TagStatService');
+
+/* Managing all possible inputs */
+isset($_GET['tag']) ? define('GET_TAG', $_GET['tag']): define('GET_TAG', '');
+isset($_GET['uId']) ? define('GET_UID', $_GET['uId']): define('GET_UID', '');
+
+
+function displayTag($tag, $uId) {
+ $uId = ($uId==0)?NULL:$uId; // if user is nobody, NULL allows to look for every public tags
+
+ $tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService');
+ $output = '{ id:'.rand().', name:\''.$tag.'\'';
+
+ $linkedTags = $tag2tagservice->getAdminLinkedTags($tag, '>');
+ if(count($linkedTags) > 0) {
+ $output.= ', children: [';
+ foreach($linkedTags as $linkedTag) {
+ $output.= displayTag($linkedTag, $uId);
+ }
+ $output = substr($output, 0, -1); // remove final comma avoiding IE6 Dojo bug
+ $output.= "]";
+ }
+
+ $output.= '},';
+ return $output;
+}
+
+?>
+
+{ label: 'name', identifier: 'id', items: [
+<?php
+$json = displayTag(GET_TAG, GET_UID);
+$json = substr($json, 0, -1); // remove final comma avoiding IE6 Dojo bug
+echo $json;
+?>
+] }
diff --git a/www/ajax/getadmintags.php b/www/ajax/getadmintags.php
new file mode 100644
index 0000000..e3d8025
--- /dev/null
+++ b/www/ajax/getadmintags.php
@@ -0,0 +1,44 @@
+<?php
+/***************************************************************************
+Copyright (C) 2004 - 2006 Scuttle project
+http://sourceforge.net/projects/scuttle/
+http://scuttle.org/
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+***************************************************************************/
+
+/* Return a json file with list of tags according to current user and sort by popularity*/
+
+require_once('../header.inc.php');
+
+/* Service creation: only useful services are created */
+$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
+$bookmarkservice =& ServiceFactory::getServiceInstance('TagService');
+
+?>
+
+{identifier:"tag",
+items: [
+<?php
+ $listTags = $b2tservice->getAdminTags(1000, $userservice->getCurrentUserId());
+ foreach($listTags as $t) {
+ echo "{tag: \"".$t['tag']."\"},";
+ }
+?>
+]}
+
+
+
+
diff --git a/www/ajax/getcontacttags.php b/www/ajax/getcontacttags.php
new file mode 100644
index 0000000..9c25e1a
--- /dev/null
+++ b/www/ajax/getcontacttags.php
@@ -0,0 +1,44 @@
+<?php
+/***************************************************************************
+Copyright (C) 2004 - 2006 Scuttle project
+http://sourceforge.net/projects/scuttle/
+http://scuttle.org/
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+***************************************************************************/
+
+/* Return a json file with list of tags according to current user and sort by popularity*/
+
+require_once('../header.inc.php');
+
+/* Service creation: only useful services are created */
+$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
+$bookmarkservice =& ServiceFactory::getServiceInstance('TagService');
+
+?>
+
+{identifier:"tag",
+items: [
+<?php
+ $listTags = $b2tservice->getContactTags($userservice->getCurrentUserId(), 1000, $userservice->getCurrentUserId());
+ foreach($listTags as $t) {
+ echo "{tag: \"".$t['tag']."\"},";
+ }
+?>
+]}
+
+
+
+
diff --git a/www/ajax/getlinkedtags.php b/www/ajax/getlinkedtags.php
new file mode 100644
index 0000000..a34805b
--- /dev/null
+++ b/www/ajax/getlinkedtags.php
@@ -0,0 +1,64 @@
+<?php
+/***************************************************************************
+ Copyright (C) 2004 - 2006 Scuttle project
+ http://sourceforge.net/projects/scuttle/
+ http://scuttle.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ ***************************************************************************/
+
+/* Return a json file with list of linked tags */
+
+require_once('../header.inc.php');
+
+/* Service creation: only useful services are created */
+$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
+$bookmarkservice =& ServiceFactory::getServiceInstance('TagService');
+$tagstatservice =& ServiceFactory::getServiceInstance('TagStatService');
+
+/* Managing all possible inputs */
+isset($_GET['tag']) ? define('GET_TAG', $_GET['tag']): define('GET_TAG', '');
+isset($_GET['uId']) ? define('GET_UID', $_GET['uId']): define('GET_UID', '');
+
+
+function displayTag($tag, $uId) {
+ $uId = ($uId==0)?NULL:$uId; // if user is nobody, NULL allows to look for every public tags
+
+ $tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService');
+ $output = '{ id:'.rand().', name:\''.$tag.'\'';
+
+ $linkedTags = $tag2tagservice->getLinkedTags($tag, '>', $uId);
+ if(count($linkedTags) > 0) {
+ $output.= ', children: [';
+ foreach($linkedTags as $linkedTag) {
+ $output.= displayTag($linkedTag, $uId);
+ }
+ $output = substr($output, 0, -1); // remove final comma avoiding IE6 Dojo bug
+ $output.= "]";
+ }
+
+ $output.= '},';
+ return $output;
+}
+
+?>
+
+{ label: 'name', identifier: 'id', items: [
+<?php
+$json = displayTag(GET_TAG, GET_UID);
+$json = substr($json, 0, -1); // remove final comma avoiding IE6 Dojo bug
+echo $json;
+?>
+] }
diff --git a/www/ajax/gettags.php b/www/ajax/gettags.php
new file mode 100644
index 0000000..7b8b33a
--- /dev/null
+++ b/www/ajax/gettags.php
@@ -0,0 +1,44 @@
+<?php
+/***************************************************************************
+Copyright (C) 2004 - 2006 Scuttle project
+http://sourceforge.net/projects/scuttle/
+http://scuttle.org/
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+***************************************************************************/
+
+/* Return a json file with list of tags according to current user and sort by popularity*/
+
+require_once('../header.inc.php');
+
+/* Service creation: only useful services are created */
+$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
+$bookmarkservice =& ServiceFactory::getServiceInstance('TagService');
+
+?>
+
+{identifier:"tag",
+items: [
+<?php
+ $listTags = $b2tservice->getPopularTags($userservice->getCurrentUserId(), 1000, $userservice->getCurrentUserId());
+ foreach($listTags as $t) {
+ echo "{tag: \"".$t['tag']."\"},";
+ }
+?>
+]}
+
+
+
+
diff --git a/www/ajaxDelete.php b/www/ajaxDelete.php
new file mode 100644
index 0000000..a1119ca
--- /dev/null
+++ b/www/ajaxDelete.php
@@ -0,0 +1,48 @@
+<?php
+/***************************************************************************
+Copyright (C) 2005 - 2006 Scuttle project
+http://sourceforge.net/projects/scuttle/
+http://scuttle.org/
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+***************************************************************************/
+
+header('Content-Type: text/xml; charset=UTF-8');
+header('Last-Modified: '. gmdate("D, d M Y H:i:s") .' GMT');
+header('Cache-Control: no-cache, must-revalidate');
+require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
+$bookmarkservice = & ServiceFactory :: getServiceInstance('BookmarkService');
+
+/* Managing all possible inputs */
+isset($_GET['id']) ? define('GET_ID', $_GET['id']): define('GET_ID', '');
+
+
+
+$bookmark = intval(GET_ID);
+if (!$bookmarkservice->editAllowed($bookmark)) {
+ $result = T_('You are not allowed to delete this bookmark');
+} elseif ($bookmarkservice->deleteBookmark($bookmark)) {
+ $result = 'true';
+} else {
+ $result = T_('Failed to delete bookmark');
+}
+
+?>
+<response>
+ <method>deleteConfirmed</method>
+ <result><?php echo $result; ?></result>
+</response> \ No newline at end of file
diff --git a/www/ajaxGetTitle.php b/www/ajaxGetTitle.php
new file mode 100644
index 0000000..fc895db
--- /dev/null
+++ b/www/ajaxGetTitle.php
@@ -0,0 +1,73 @@
+<?php
+/***************************************************************************
+ Copyright (C) 2005 - 2006 Scuttle project
+ http://sourceforge.net/projects/scuttle/
+ http://scuttle.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ ***************************************************************************/
+
+header('Content-Type: text/xml; charset=UTF-8');
+header("Last-Modified: ". gmdate("D, d M Y H:i:s") ." GMT");
+header("Cache-Control: no-cache, must-revalidate");
+
+require_once('header.inc.php');
+
+/* Managing all possible inputs */
+isset($_GET['url']) ? define('GET_URL', $_GET['url']): define('GET_URL', '');
+
+function getTitle($url) {
+ $fd = @fopen($url, 'r');
+ if ($fd) {
+ $html = fread($fd, 1750);
+ fclose($fd);
+
+ // Get title from title tag
+ preg_match_all('/<title>(.*)<\/title>/si', $html, $matches);
+ $title = $matches[1][0];
+
+ // Get encoding from charset attribute
+ preg_match_all('/<meta.*charset=([^;"]*)">/i', $html, $matches);
+ $encoding = strtoupper($matches[1][0]);
+
+ // Convert to UTF-8 from the original encoding
+ if (function_exists("mb_convert_encoding")) {
+ $title = @mb_convert_encoding($title, 'UTF-8', $encoding);
+ }
+
+ if (utf8_strlen($title) > 0) {
+ return $title;
+ } else {
+ // No title, so return filename
+ $uriparts = explode('/', $url);
+ $filename = end($uriparts);
+ unset($uriparts);
+
+ return $filename;
+ }
+ } else {
+ return false;
+ }
+}
+echo '<?xml version="1.0" encoding="utf-8"?>';
+?>
+<response>
+<method>
+getTitle
+</method>
+<result>
+<?php echo getTitle(GET_URL); ?>
+</result>
+</response>
diff --git a/www/ajaxIsAvailable.php b/www/ajaxIsAvailable.php
new file mode 100644
index 0000000..ffd4379
--- /dev/null
+++ b/www/ajaxIsAvailable.php
@@ -0,0 +1,44 @@
+<?php
+/***************************************************************************
+Copyright (C) 2006 Scuttle project
+http://sourceforge.net/projects/scuttle/
+http://scuttle.org/
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+***************************************************************************/
+
+header('Content-Type: text/xml; charset=UTF-8');
+header("Last-Modified: ". gmdate("D, d M Y H:i:s") ." GMT");
+header("Cache-Control: no-cache, must-revalidate");
+
+require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
+//No specific services
+
+/* Managing all possible inputs */
+isset($_GET['username']) ? define('GET_USERNAME', $_GET['username']): define('GET_USERNAME', '');
+
+
+if ($userservice->isReserved(GET_USERNAME)) {
+ $result = 'false';
+} else {
+ $result = $userservice->getUserByUsername(GET_USERNAME) ? 'false' : 'true';
+}
+?>
+<response>
+ <method>isAvailable</method>
+ <result><?php echo $result; ?></result>
+</response> \ No newline at end of file
diff --git a/www/alltags.php b/www/alltags.php
new file mode 100644
index 0000000..95e797a
--- /dev/null
+++ b/www/alltags.php
@@ -0,0 +1,87 @@
+<?php
+/***************************************************************************
+ Copyright (C) 2004 - 2006 Scuttle project
+ http://sourceforge.net/projects/scuttle/
+ http://scuttle.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ ***************************************************************************/
+
+require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
+$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
+$cacheservice =& ServiceFactory::getServiceInstance('CacheService');
+
+
+
+list($url, $user) = explode('/', $_SERVER['PATH_INFO']);
+if (!$user) {
+ header('Location: '. createURL('populartags'));
+ exit;
+}
+
+if ($usecache) {
+ // Generate hash for caching on
+ $hashtext = $_SERVER['REQUEST_URI'];
+ if ($userservice->isLoggedOn()) {
+ $hashtext .= $userservice->getCurrentUserID();
+ }
+ $hash = md5($hashtext);
+
+ // Cache for an hour
+ $cacheservice->Start($hash, 3600);
+}
+
+// Header variables
+$pagetitle = T_('All Tags');
+
+if (isset($user) && $user != '') {
+
+ $userid = $userservice->getIdFromUser($user);
+ if($userid == NULL) {
+ $tplVars['error'] = sprintf(T_('User with username %s was not found'), $user);
+ $templateservice->loadTemplate('error.404.tpl', $tplVars);
+ exit();
+ }
+
+ $pagetitle .= ': '. ucfirst($user);
+} else {
+ $userid = NULL;
+}
+
+$tags =& $b2tservice->getTags($userid);
+$tplVars['tags'] =& $b2tservice->tagCloud($tags, 5, 90, 225, getSortOrder());
+$tplVars['user'] = $user;
+
+if (isset($userid)) {
+ $tplVars['cat_url'] = createURL('bookmarks', '%s/%s');
+} else {
+ $tplVars['cat_url'] = createURL('tags', '%2$s');
+}
+
+$tplVars['sidebar_blocks'] = array('linked');
+$tplVars['userid'] = $userid;
+$tplVars['loadjs'] = true;
+
+$tplVars['pagetitle'] = $pagetitle;
+$tplVars['subtitle'] = $pagetitle;
+$templateservice->loadTemplate('tags.tpl', $tplVars);
+
+if ($usecache) {
+ // Cache output if existing copy has expired
+ $cacheservice->End($hash);
+}
+?>
diff --git a/www/api/export_csv.php b/www/api/export_csv.php
new file mode 100644
index 0000000..2389642
--- /dev/null
+++ b/www/api/export_csv.php
@@ -0,0 +1,47 @@
+<?php
+// Export in CSV format in order to allow the import into a spreadsheet tool like Excel
+
+// Force HTTP authentication first!
+require_once('httpauth.inc.php');
+require_once('../header.inc.php');
+
+/* Service creation: only useful services are created */
+$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
+
+// Check to see if a tag was specified.
+if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != ''))
+ $tag = trim($_REQUEST['tag']);
+else
+ $tag = NULL;
+
+// Get the posts relevant to the passed-in variables.
+$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag, NULL, getSortOrder());
+
+header("Content-Type: application/csv-tab-delimited-table;charset=UTF-8");
+header("Content-disposition: filename=exportBookmarks.csv");
+
+//columns titles
+echo 'url;title;tags;description';
+echo "\n";
+
+foreach($bookmarks['bookmarks'] as $row) {
+ if (is_null($row['bDescription']) || (trim($row['bDescription']) == ''))
+ $description = '';
+ else
+ $description = filter(str_replace(array("\r\n", "\n", "\r"),"", $row['bDescription']), 'xml');
+
+ $taglist = '';
+ if (count($row['tags']) > 0) {
+ foreach($row['tags'] as $tag)
+ $taglist .= convertTag($tag) .',';
+ $taglist = substr($taglist, 0, -1);
+ } else {
+ $taglist = 'system:unfiled';
+ }
+
+ echo '"'.filter($row['bAddress'], 'xml') .'";"'. filter($row['bTitle'], 'xml') .'";"'. filter($taglist, 'xml') .'";"'. $description .'"';
+ echo "\n";
+}
+
+
+?>
diff --git a/www/api/export_gcs.php b/www/api/export_gcs.php
new file mode 100644
index 0000000..6f1f4c2
--- /dev/null
+++ b/www/api/export_gcs.php
@@ -0,0 +1,66 @@
+<?php
+/*
+ Export for Google Custom Search
+ */
+
+// Force HTTP authentication first!
+//require_once('httpauth.inc.php');
+require_once('../header.inc.php');
+
+if($GLOBALS['enableGoogleCustomSearch'] == false) {
+ echo "Google Custom Search disabled. You can enable it into the config.inc.php file.";
+ die;
+}
+
+/* Service creation: only useful services are created */
+$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
+
+
+/*
+ // Restrict to admins?
+ if(!$userservice->isAdmin($userservice->getCurrentUserId())) {
+ die(T_('You are not allowed to do this action (admin access)'));
+ }*/
+
+// Check if queried format is xml
+if (isset($_REQUEST['xml']) && (trim($_REQUEST['xml']) == 1))
+$xml = true;
+else
+$xml = false;
+
+// Check to see if a tag was specified.
+if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != ''))
+$tag = trim($_REQUEST['tag']);
+else
+$tag = NULL;
+
+// Get the posts relevant to the passed-in variables.
+$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, NULL, $tag, NULL, getSortOrder());
+
+
+// Set up the plain file and output all the posts.
+header('Content-Type: text/plain');
+if(!$xml) {
+ header('Content-Type: text/plain');
+ foreach($bookmarks['bookmarks'] as $row) {
+ if(checkUrl($row['bAddress'], false)) {
+ echo $row['bAddress']."\n";
+ }
+ }
+} else {
+ header('Content-Type: application/xml');
+ echo '<GoogleCustomizations>'."\n";
+ echo ' <Annotations>'."\n";
+ foreach($bookmarks['bookmarks'] as $row) {
+ //if(substr($row['bAddress'], 0, 7) == "http://") {
+ if(checkUrl($row['bAddress'], false)) {
+ echo ' <Annotation about="'.filter($row['bAddress']).'">'."\n";
+ echo ' <Label name="include"/>'."\n";
+ echo ' </Annotation>'."\n";
+ }
+ }
+ echo ' </Annotations>'."\n";
+ echo '</GoogleCustomizations>'."\n";
+}
+
+?>
diff --git a/www/api/export_html.php b/www/api/export_html.php
new file mode 100644
index 0000000..55553c2
--- /dev/null
+++ b/www/api/export_html.php
@@ -0,0 +1,54 @@
+<?php
+// Implements the del.icio.us API request for all a user's posts, optionally filtered by tag.
+
+// del.icio.us behavior:
+// - doesn't include the filtered tag as an attribute on the root element (we do)
+
+// Force HTTP authentication first!
+require_once('httpauth.inc.php');
+require_once('../header.inc.php');
+
+/* Service creation: only useful services are created */
+$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
+
+// Check to see if a tag was specified.
+if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != ''))
+ $tag = trim($_REQUEST['tag']);
+else
+ $tag = NULL;
+
+// Get the posts relevant to the passed-in variables.
+$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag, NULL, getSortOrder());
+
+
+// Set up the XML file and output all the posts.
+echo '<!DOCTYPE NETSCAPE-Bookmark-file-1>'."\r\n";
+echo '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">';
+echo '<!-- This is an automatically generated file. -->'."\r\n";
+echo '<TITLE>Bookmarks</TITLE>'."\r\n";
+echo '<H1 LAST_MODIFIED="'. date('U') .'">Bookmarks for '. htmlspecialchars($currentUser->getUsername()) .''. (is_null($tag) ? '' : ' tag="'. htmlspecialchars($tag) .'"') ." from " . $sitename ."</H1>\r\n";
+echo '<DL><p>'."\r\n";
+
+
+
+foreach($bookmarks['bookmarks'] as $row) {
+ if (is_null($row['bDescription']) || (trim($row['bDescription']) == ''))
+ $description = '';
+ else
+ $description = 'description="'. filter($row['bDescription'], 'xml') .'" ';
+
+ $taglist = '';
+ if (count($row['tags']) > 0) {
+ foreach($row['tags'] as $tag)
+ $taglist .= convertTag($tag) .',';
+ $taglist = substr($taglist, 0, -1);
+ } else {
+ $taglist = 'system:unfiled';
+ }
+
+ echo "\t<dt><a href=\"". filter($row['bAddress'], 'xml') .'" '. $description .' hash="'. md5($row['bAddress']) .'" tags="'. filter($taglist, 'xml') .'" ADD_DATE="'. date('U', strtotime($row['bDatetime'])) ."\" >" . filter($row['bTitle'], 'xml') ."</a>\r\n";
+}
+
+
+echo '</DL><p>';
+?>
diff --git a/www/api/export_sioc.php b/www/api/export_sioc.php
new file mode 100644
index 0000000..746d0ea
--- /dev/null
+++ b/www/api/export_sioc.php
@@ -0,0 +1,90 @@
+<?php
+/* Export data with semantic format (SIOC: http://sioc-project.org/, FOAF, SKOS, Annotea Ontology) */
+
+require_once('../header.inc.php');
+header('Content-Type: text/xml; charset=utf-8'); //we change headers html defined in headers.inc.php
+
+/* Service creation: only useful services are created */
+$userservice =& ServiceFactory::getServiceInstance('UserService');
+$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
+
+?>
+<?php echo "<?xml version=\"1.0\" encoding=\"utf-8\"\n?>"; ?>
+<rdf:RDF
+ xmlns="http://xmlns.com/foaf/0.1/"
+ xmlns:foaf="http://xmlns.com/foaf/0.1/"
+ xmlns:rss="http://purl.org/rss/1.0/"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dcterms="http://purl.org/dc/terms/"
+ xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:sioc="http://rdfs.org/sioc/ns#"
+ xmlns:sioc_t="http://rdfs.org/sioc/types#"
+ xmlns:bm="http://www.w3.org/2002/01/bookmark#"
+ xmlns:skos="http://www.w3.org/2004/02/skos/core#">
+
+<?php
+//site and community are described using FOAF and SIOC ontology
+?>
+<sioc:Site rdf:about="<?php echo ROOT?>" >
+ <rdf:label><?php echo $GLOBALS['sitename']?></rdf:label>
+</sioc:Site>
+
+<?php //<sioc_t:BookmarkFolder />?>
+
+<?php
+//users are described using FOAF and SIOC ontology
+$users = $userservice->getObjectUsers();
+
+$usersArray = array(); // useful for bookmarks display
+foreach($users as $user) {
+ $usersArray[$user->getId()] = $user->getUserName();
+}
+?>
+
+<?php foreach($users as $user) :?>
+<sioc:User rdf:about="<?php echo createUrl('profile', $user->getUserName())?>">
+ <sioc:name><?php echo $user->getUserName() ?></sioc:name>
+ <sioc:member_of rdf:resource="<?php echo ROOT?>" />
+</sioc:User>
+<?php endforeach; ?>
+
+<?php
+/*
+No page for usergroup (users/admin) for the moment
+ <sioc:Usergroup rdf:ID="authors">
+ <sioc:name>Authors at PlanetRDF.com</sioc:name>
+ <sioc:has_member rdf:nodeID="sioc-id2245901" />
+ </sioc:Usergroup>
+*/
+?>
+
+<?php
+//bookmarks are described using Annotea ontology
+$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, NULL, NULL);
+?>
+
+<?php foreach($bookmarks['bookmarks'] as $bookmark): ?>
+<bm:Bookmark rdf:about="<?php echo createUrl('history', $bookmark['bHash']) ?>">
+ <dc:title><?php echo filter($bookmark['bTitle']) ?></dc:title>
+ <dc:created><?php echo filter($bookmark['bCreated']) ?></dc:created>
+ <dc:description><?php echo filter(strip_tags($bookmark['bDescription'])) ?></dc:description>
+ <dc:date><?php echo $bookmark['bDateTime'] ?></dc:date>
+ <bm:recalls rdf:resource="<?php echo filter($bookmark['bAddress']) ?>"/>
+ <sioc:owner_of rdf:resource="<?php echo createUrl('profile', $usersArray[$bookmark['uId']]) ?>"/>
+ <?php foreach($bookmark['tags'] as $tag): ?>
+ <sioc:topic>
+ <skos:concept rdf:about="<?php echo createUrl('bookmarks', $usersArray[$bookmark['uId']].'/'.$tag) ?>" />
+ </sioc:topic>
+ <?php endforeach; ?>
+</bm:Bookmark>
+
+<?php endforeach; ?>
+
+<?php
+// tags and concepts are described using SKOS ontology
+//concept for user/admins, preflabel, definition, top concept
+?>
+
+</rdf:RDF>
+
diff --git a/www/api/httpauth.inc.php b/www/api/httpauth.inc.php
new file mode 100644
index 0000000..5dd7444
--- /dev/null
+++ b/www/api/httpauth.inc.php
@@ -0,0 +1,33 @@
+<?php
+require_once('../header.inc.php');
+
+// Provides HTTP Basic authentication of a user, and sets two variables, sId and username,
+// with the user's info.
+
+function authenticate() {
+ header('WWW-Authenticate: Basic realm="SemanticScuttle API"');
+ header('HTTP/1.0 401 Unauthorized');
+
+ die(T_("Use of the API calls requires authentication."));
+}
+
+if(!$userservice->isLoggedOn()) {
+ /* Maybe we have caught authentication data in $_SERVER['REMOTE_USER']
+ ( Inspired by http://www.yetanothercommunitysystem.com/article-321-regle-comment-utiliser-l-authentification-http-en-php-chez-ovh ) */
+ if((!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']))
+ && preg_match('/Basic\s+(.*)$/i', $_SERVER['REMOTE_USER'], $matches)) {
+ list($name, $password) = explode(':', base64_decode($matches[1]));
+ $_SERVER['PHP_AUTH_USER'] = strip_tags($name);
+ $_SERVER['PHP_AUTH_PW'] = strip_tags($password);
+ }
+
+ if (!isset($_SERVER['PHP_AUTH_USER'])) {
+ authenticate();
+ } else {
+ $login = $userservice->login($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
+ if (!$login) {
+ authenticate();
+ }
+ }
+}
+?>
diff --git a/www/api/opensearch.php b/www/api/opensearch.php
new file mode 100644
index 0000000..a6f79f8
--- /dev/null
+++ b/www/api/opensearch.php
@@ -0,0 +1,18 @@
+<?php
+require_once('../header.inc.php');
+header("Content-type: text/xml");
+?>
+
+<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
+ xmlns:moz="http://www.mozilla.org/2006/browser/search/">
+ <ShortName><?php echo $GLOBALS['sitename']?></ShortName>
+ <LongName></LongName>
+ <Description><?php echo $GLOBALS['welcomeMessage']?></Description>
+ <InputEncoding>UTF-8</InputEncoding>
+ <Contact><?php echo $GLOBALS['adminemail']?></Contact>
+ <Developer>Jan Seifert "jan.seifert@uid.com"</Developer>
+ <Tags>semanticscuttle bookmark web</Tags>
+ <Image width="16" height="16">data:image/gif;base64,R0lGODlhEAAQAMZ9ANaPE9mREteTHtSXLdmXIdiXJtaYKdiYJ9iYKNeaLtKdP9CdRd2dLNWfQuWiFMqjX9+hNMykXt6jPOCkPM2oaM+paeCpQuGoR+OqOeKpR+GqS9+uWeSwU+ayS+uzOeWxVeWxWOSyWOu0POazXOS0YOm8Zee8cOy+WOm9a/jBLum+bPbCNurAbe7BYuvBc/LDV/LEV+zEdv/KKf/KLP/KLf/LLuzHe//MNP/NN/nMTv/OOf/OPP/OP/jNW//PPvnOVv/QQv7QRv/QRP/RR/HOhP/SSf/STPnRav/TT//TUPfScf/UUvzUXP/UVP/VV/bTfv/WWf/WW//WXP7XYf/XX//XYP/YZPPVmf/ZZv/ZZ/vYeP/aaf/aa//abP/abf/abvvaef/bb//bcfzbfP/ccv/cc//cdP/cdf/dd//deP/def3egP/ee//efP/efv/ffv/ggf/gg//ghP/ghfrfmv/hif/ii//ijP/jkfzjm//kkv7klv/lmP///////////yH5BAEKAH8ALAAAAAAQABAAAAergH+Cg38hhIeHIFcmiIgDLnt0Go2EE1pyd0QbjQMQDC9bZGprKBcjA4IfAQMrQUhOVFlhaGNPMRl/Aw4yMzc7QkZNUlZdZmASqAJKcW1WPDpARUtQUx0RgyR5fHpzUTU4PkMiqIMVNnh2c25lSTQpAIgqdXJvaWReXz0JiCxwbWhiuGCp8uMAohJszhw5AYMJlBwFEHFoYQHBAwUEMHgwgKjBA0QLKFAaKSgQADs=</Image>
+ <Url type="text/html" template="<?php echo $GLOBALS['root']?>search.php/all/{searchTerms}"/>
+ <moz:SearchForm><?php echo $GLOBALS['root']?></moz:SearchForm>
+</OpenSearchDescription>
diff --git a/www/api/posts_add.php b/www/api/posts_add.php
new file mode 100644
index 0000000..ba3e02c
--- /dev/null
+++ b/www/api/posts_add.php
@@ -0,0 +1,83 @@
+<?php
+// Implements the del.icio.us API request to add a new post.
+
+// del.icio.us behavior:
+// - tags can't have spaces
+// - address and description are mandatory
+
+// Scuttle behavior:
+// - Additional 'status' variable for privacy
+// - No support for 'replace' variable
+
+// Force HTTP authentication
+require_once('httpauth.inc.php');
+require_once('../header.inc.php');
+
+/* Service creation: only useful services are created */
+$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
+
+// Get all the bookmark's passed-in information
+if (isset($_REQUEST['url']) && (trim($_REQUEST['url']) != ''))
+ $url = trim(urldecode($_REQUEST['url']));
+else
+ $url = NULL;
+
+if (isset($_REQUEST['description']) && (trim($_REQUEST['description']) != ''))
+ $description = trim($_REQUEST['description']);
+else
+ $description = NULL;
+
+if (isset($_REQUEST['extended']) && (trim($_REQUEST['extended']) != ""))
+ $extended = trim($_REQUEST['extended']);
+else
+ $extended = NULL;
+
+if (isset($_REQUEST['tags']) && (trim($_REQUEST['tags']) != '') && (trim($_REQUEST['tags']) != ','))
+ $tags = trim($_REQUEST['tags']);
+else
+ $tags = NULL;
+
+if (isset($_REQUEST['dt']) && (trim($_REQUEST['dt']) != ''))
+ $dt = trim($_REQUEST['dt']);
+else
+ $dt = NULL;
+
+$status = 0;
+if (isset($_REQUEST['status'])) {
+ $status_str = trim($_REQUEST['status']);
+ if (is_numeric($status_str)) {
+ $status = intval($status_str);
+ if($status < 0 || $status > 2) {
+ $status = 0;
+ }
+ } else {
+ switch ($status_str) {
+ case 'private':
+ $status = 2;
+ break;
+ case 'shared':
+ $status = 1;
+ break;
+ default:
+ $status = 0;
+ break;
+ }
+ }
+}
+
+// Error out if there's no address or description
+if (is_null($url) || is_null($description)) {
+ $added = false;
+} else {
+// We're good with info; now insert it!
+ if ($bookmarkservice->bookmarkExists($url, $userservice->getCurrentUserId()))
+ $added = false;
+ else
+ $added = $bookmarkservice->addBookmark($url, $description, $extended, '', $status, $tags, $dt, true);
+}
+
+// Set up the XML file and output the result.
+header('Content-Type: text/xml');
+echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
+echo '<result code="'. ($added ? 'done' : 'something went wrong') .'" />';
+?> \ No newline at end of file
diff --git a/www/api/posts_all.php b/www/api/posts_all.php
new file mode 100644
index 0000000..4ecbd7e
--- /dev/null
+++ b/www/api/posts_all.php
@@ -0,0 +1,48 @@
+<?php
+// Implements the del.icio.us API request for all a user's posts, optionally filtered by tag.
+
+// del.icio.us behavior:
+// - doesn't include the filtered tag as an attribute on the root element (we do)
+
+// Force HTTP authentication first!
+require_once('httpauth.inc.php');
+require_once('../header.inc.php');
+
+/* Service creation: only useful services are created */
+$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
+
+
+// Check to see if a tag was specified.
+if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != ''))
+ $tag = trim($_REQUEST['tag']);
+else
+ $tag = NULL;
+
+// Get the posts relevant to the passed-in variables.
+$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag);
+
+// Set up the XML file and output all the posts.
+header('Content-Type: text/xml');
+echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
+echo '<posts update="'. gmdate('Y-m-d\TH:i:s\Z') .'" user="'. htmlspecialchars($currentUser->getUsername()) .'"'. (is_null($tag) ? '' : ' tag="'. htmlspecialchars($tag) .'"') .">\r\n";
+
+foreach($bookmarks['bookmarks'] as $row) {
+ if (is_null($row['bDescription']) || (trim($row['bDescription']) == ''))
+ $description = '';
+ else
+ $description = 'extended="'. filter($row['bDescription'], 'xml') .'" ';
+
+ $taglist = '';
+ if (count($row['tags']) > 0) {
+ foreach($row['tags'] as $tag)
+ $taglist .= convertTag($tag) .' ';
+ $taglist = substr($taglist, 0, -1);
+ } else {
+ $taglist = 'system:unfiled';
+ }
+
+ echo "\t<post href=\"". filter($row['bAddress'], 'xml') .'" description="'. filter($row['bTitle'], 'xml') .'" '. $description .'hash="'. md5($row['bAddress']) .'" tag="'. filter($taglist, 'xml') .'" time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) ."\" />\r\n";
+}
+
+echo '</posts>';
+?> \ No newline at end of file
diff --git a/www/api/posts_dates.php b/www/api/posts_dates.php
new file mode 100644
index 0000000..d4962ff
--- /dev/null
+++ b/www/api/posts_dates.php
@@ -0,0 +1,40 @@
+<?php
+// Implements the del.icio.us API request for a user's post counts by date (and optionally
+// by tag).
+
+// Force HTTP authentication first!
+require_once('httpauth.inc.php');
+require_once('../header.inc.php');
+
+/* Service creation: only useful services are created */
+$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
+
+
+// Check to see if a tag was specified.
+if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != ''))
+ $tag = trim($_REQUEST['tag']);
+else
+ $tag = NULL;
+
+// Get the posts relevant to the passed-in variables.
+$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag);
+
+// Set up the XML file and output all the tags.
+header('Content-Type: text/xml');
+echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
+echo '<dates tag="'. (is_null($tag) ? '' : filter($tag, 'xml')) .'" user="'. filter($currentUser->getUsername(), 'xml') ."\">\r\n";
+
+$lastdate = NULL;
+foreach($bookmarks['bookmarks'] as $row) {
+ $thisdate = gmdate('Y-m-d', strtotime($row['bDatetime']));
+ if ($thisdate != $lastdate && $lastdate != NULL) {
+ echo "\t<date count=\"". $count .'" date="'. $lastdate ."\" />\r\n";
+ $count = 1;
+ } else {
+ $count = $count + 1;
+ }
+ $lastdate = $thisdate;
+}
+
+echo "</dates>";
+?> \ No newline at end of file
diff --git a/www/api/posts_delete.php b/www/api/posts_delete.php
new file mode 100644
index 0000000..d24ba59
--- /dev/null
+++ b/www/api/posts_delete.php
@@ -0,0 +1,34 @@
+<?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).
+
+// Force HTTP authentication first!
+require_once('httpauth.inc.php');
+require_once('../header.inc.php');
+
+/* Service creation: only useful services are created */
+$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
+
+
+// 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;
+} else {
+ $bookmark = $bookmarkservice->getBookmarkByAddress($_REQUEST['url']);
+ $bid = $bookmark['bId'];
+ $delete = $bookmarkservice->deleteBookmark($bid);
+ $deleted = true;
+}
+
+// Set up the XML file and output the result.
+header('Content-Type: text/xml');
+echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
+echo '<result code="'. ($deleted ? 'done' : 'something went wrong') .'" />';
+?> \ No newline at end of file
diff --git a/www/api/posts_get.php b/www/api/posts_get.php
new file mode 100644
index 0000000..34d192e
--- /dev/null
+++ b/www/api/posts_get.php
@@ -0,0 +1,61 @@
+<?php
+// Implements the del.icio.us API request for a user's posts, optionally filtered by tag and/or
+// date. Note that when using a date to select the posts returned, del.icio.us uses GMT dates --
+// so we do too.
+
+// del.icio.us behavior:
+// - includes an empty tag attribute on the root element when it hasn't been specified
+
+// Scuttle behavior:
+// - Uses today, instead of the last bookmarked date, if no date is specified
+
+// Force HTTP authentication first!
+require_once('httpauth.inc.php');
+require_once('../header.inc.php');
+
+/* Service creation: only useful services are created */
+$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
+
+
+// Check to see if a tag was specified.
+if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != ''))
+ $tag = trim($_REQUEST['tag']);
+else
+ $tag = NULL;
+
+// Check to see if a date was specified; the format should be YYYY-MM-DD
+if (isset($_REQUEST['dt']) && (trim($_REQUEST['dt']) != ""))
+ $dtstart = trim($_REQUEST['dt']);
+else
+ $dtstart = date('Y-m-d H:i:s');
+$dtend = date('Y-m-d H:i:s', strtotime($dtstart .'+1 day'));
+
+// Get the posts relevant to the passed-in variables.
+$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag, NULL, NULL, NULL, $dtstart, $dtend);
+
+
+// Set up the XML file and output all the tags.
+header('Content-Type: text/xml');
+echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
+echo '<posts'. (is_null($dtstart) ? '' : ' dt="'. $dtstart .'"') .' tag="'. (is_null($tag) ? '' : filter($tag, 'xml')) .'" user="'. filter($currentUser->getUsername(), 'xml') ."\">\r\n";
+
+foreach($bookmarks['bookmarks'] as $row) {
+ if (is_null($row['bDescription']) || (trim($row['bDescription']) == ''))
+ $description = '';
+ else
+ $description = 'extended="'. filter($row['bDescription'], 'xml') .'" ';
+
+ $taglist = '';
+ if (count($row['tags']) > 0) {
+ foreach($row['tags'] as $tag)
+ $taglist .= convertTag($tag) .' ';
+ $taglist = substr($taglist, 0, -1);
+ } else {
+ $taglist = 'system:unfiled';
+ }
+
+ echo "\t<post href=\"". filter($row['bAddress'], 'xml') .'" description="'. filter($row['bTitle'], 'xml') .'" '. $description .'hash="'. $row['bHash'] .'" others="'. $bookmarkservice->countOthers($row['bAddress']) .'" tag="'. filter($taglist, 'xml') .'" time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) ."\" />\r\n";
+}
+
+echo '</posts>';
+?> \ No newline at end of file
diff --git a/www/api/posts_public.php b/www/api/posts_public.php
new file mode 100644
index 0000000..f7aa955
--- /dev/null
+++ b/www/api/posts_public.php
@@ -0,0 +1,48 @@
+<?php
+// Implements the del.icio.us API request for all a user's posts, optionally filtered by tag.
+
+// del.icio.us behavior:
+// - doesn't include the filtered tag as an attribute on the root element (we do)
+
+// Force HTTP authentication first!
+//require_once('httpauth.inc.php');
+require_once('../header.inc.php');
+
+/* Service creation: only useful services are created */
+$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
+
+
+// Check to see if a tag was specified.
+if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != ''))
+ $tag = trim($_REQUEST['tag']);
+else
+ $tag = NULL;
+
+// Get the posts relevant to the passed-in variables.
+$bookmarks =& $bookmarkservice->getBookmarks(0, NULL, NULL, $tag);
+
+// Set up the XML file and output all the posts.
+header('Content-Type: text/xml');
+echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
+echo '<posts update="'. gmdate('Y-m-d\TH:i:s\Z') .'" '. (is_null($tag) ? '' : ' tag="'. htmlspecialchars($tag) .'"') .">\r\n";
+
+foreach($bookmarks['bookmarks'] as $row) {
+ if (is_null($row['bDescription']) || (trim($row['bDescription']) == ''))
+ $description = '';
+ else
+ $description = 'extended="'. filter($row['bDescription'], 'xml') .'" ';
+
+ $taglist = '';
+ if (count($row['tags']) > 0) {
+ foreach($row['tags'] as $tag)
+ $taglist .= convertTag($tag) .' ';
+ $taglist = substr($taglist, 0, -1);
+ } else {
+ $taglist = 'system:unfiled';
+ }
+
+ echo "\t<post href=\"". filter($row['bAddress'], 'xml') .'" description="'. filter($row['bTitle'], 'xml') .'" '. $description .'hash="'. md5($row['bAddress']) .'" tag="'. filter($taglist, 'xml') .'" time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) ."\" />\r\n";
+}
+
+echo '</posts>';
+?>
diff --git a/www/api/posts_recent.php b/www/api/posts_recent.php
new file mode 100644
index 0000000..daa9d39
--- /dev/null
+++ b/www/api/posts_recent.php
@@ -0,0 +1,62 @@
+<?php
+// Implements the del.icio.us API request for a user's recent posts, optionally filtered by
+// tag and/or number of posts (default 15, max 100, just like del.icio.us).
+
+// Set default and max number of posts
+$countDefault = 15;
+$countMax = 100;
+
+// Force HTTP authentication first!
+require_once('httpauth.inc.php');
+require_once('../header.inc.php');
+
+/* Service creation: only useful services are created */
+$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
+
+
+// Check to see if a tag was specified.
+if (isset($_REQUEST['tag']) && (trim($_REQUEST['tag']) != ''))
+ $tag = trim($_REQUEST['tag']);
+else
+ $tag = NULL;
+
+// Check to see if the number of items was specified.
+if (isset($_REQUEST['count']) && (intval($_REQUEST['count']) != 0)) {
+ $count = intval($_REQUEST['count']);
+ if ($count > $countMax)
+ $count = $countMax;
+ elseif ($count < 0)
+ $count = 0;
+} else {
+ $count = $countDefault;
+}
+
+// Get the posts relevant to the passed-in variables.
+$bookmarks =& $bookmarkservice->getBookmarks(0, $count, $userservice->getCurrentUserId(), $tag);
+
+
+// Set up the XML file and output all the tags.
+header('Content-Type: text/xml');
+echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
+echo '<posts tag="'. (is_null($tag) ? '' : filter($tag, 'xml')) .'" user="'. filter($currentUser->getUsername(), 'xml') ."\">\r\n";
+
+foreach($bookmarks['bookmarks'] as $row) {
+ if (is_null($row['bDescription']) || (trim($row['bDescription']) == ''))
+ $description = '';
+ else
+ $description = 'extended="'. filter($row['bDescription'], 'xml') .'" ';
+
+ $taglist = '';
+ if (count($row['tags']) > 0) {
+ foreach($row['tags'] as $tag)
+ $taglist .= convertTag($tag) .' ';
+ $taglist = substr($taglist, 0, -1);
+ } else {
+ $taglist = 'system:unfiled';
+ }
+
+ echo "\t<post href=\"". filter($row['bAddress'], 'xml') .'" description="'. filter($row['bTitle'], 'xml') .'" '. $description .'hash="'. $row['bHash'] .'" tag="'. filter($taglist, 'xml') .'" time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) ."\" />\r\n";
+}
+
+echo '</posts>';
+?> \ No newline at end of file
diff --git a/www/api/posts_update.php b/www/api/posts_update.php
new file mode 100644
index 0000000..6ea50e2
--- /dev/null
+++ b/www/api/posts_update.php
@@ -0,0 +1,25 @@
+<?php
+// Implements the del.icio.us API request for a user's last update time and date.
+
+// del.icio.us behavior:
+// - doesn't set the Content-Type to text/xml (we do).
+
+// Force HTTP authentication first!
+require_once('httpauth.inc.php');
+require_once('../header.inc.php');
+
+/* Service creation: only useful services are created */
+$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
+
+
+// Get the posts relevant to the passed-in variables.
+$bookmarks =& $bookmarkservice->getBookmarks(0, 1, $userservice->getCurrentUserId());
+
+
+// Set up the XML file and output all the tags.
+header('Content-Type: text/xml');
+echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
+foreach($bookmarks['bookmarks'] as $row) {
+ echo '<update time="'. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime'])) .'" />';
+}
+?> \ No newline at end of file
diff --git a/www/api/tags_get.php b/www/api/tags_get.php
new file mode 100644
index 0000000..cee36ee
--- /dev/null
+++ b/www/api/tags_get.php
@@ -0,0 +1,26 @@
+<?php
+// Implements the del.icio.us API request for all a user's tags.
+
+// del.icio.us behavior:
+// - tags can't have spaces
+
+// Force HTTP authentication first!
+require_once('httpauth.inc.php');
+require_once('../header.inc.php');
+
+/* Service creation: only useful services are created */
+$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
+
+
+// Get the tags relevant to the passed-in variables.
+$tags =& $b2tservice->getTags($userservice->getCurrentUserId());
+
+// Set up the XML file and output all the tags.
+header('Content-Type: text/xml');
+echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
+echo "<tags>\r\n";
+foreach($tags as $row) {
+ echo "\t<tag count=\"". $row['bCount'] .'" tag="'. filter(convertTag($row['tag'], 'out'), 'xml') ."\" />\r\n";
+}
+echo "</tags>";
+?>
diff --git a/www/api/tags_rename.php b/www/api/tags_rename.php
new file mode 100644
index 0000000..dd16339
--- /dev/null
+++ b/www/api/tags_rename.php
@@ -0,0 +1,37 @@
+<?php
+// Implements the del.icio.us API request to rename a user's tag.
+
+// del.icio.us behavior:
+// - oddly, returns an entirely different result (<result></result>) than the other API calls.
+
+// Force HTTP authentication first!
+require_once('httpauth.inc.php');
+require_once('../header.inc.php');
+
+/* Service creation: only useful services are created */
+$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
+
+// Get the tag info.
+if (isset($_REQUEST['old']) && (trim($_REQUEST['old']) != ''))
+ $old = trim($_REQUEST['old']);
+else
+ $old = NULL;
+
+if (isset($_REQUEST['new']) && (trim($_REQUEST['new']) != ''))
+ $new = trim($_REQUEST['new']);
+else
+ $new = NULL;
+
+if (is_null($old) || is_null($new)) {
+ $renamed = false;
+} else {
+ // Rename the tag.
+ $result = $b2tservice->renameTag($userservice->getCurrentUserId(), $old, $new, true);
+ $renamed = $result;
+}
+
+// Set up the XML file and output the result.
+header('Content-Type: text/xml');
+echo '<?xml version="1.0" standalone="yes" ?'.">\r\n";
+echo '<result>'. ($renamed ? 'done' : 'something went wrong') .'</result>';
+?>
diff --git a/www/bookmarkcommondescriptionedit.php b/www/bookmarkcommondescriptionedit.php
new file mode 100644
index 0000000..ac1890e
--- /dev/null
+++ b/www/bookmarkcommondescriptionedit.php
@@ -0,0 +1,78 @@
+<?php
+/***************************************************************************
+ Copyright (C) 2006 - 2007 Scuttle project
+ http://sourceforge.net/projects/scuttle/
+ http://scuttle.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ ***************************************************************************/
+
+require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
+$bookmarkservice = & ServiceFactory :: getServiceInstance('BookmarkService');
+$cdservice = & ServiceFactory :: getServiceInstance('CommonDescriptionService');
+
+/* Managing all possible inputs */
+isset($_POST['confirm']) ? define('POST_CONFIRM', $_POST['confirm']): define('POST_CONFIRM', '');
+isset($_POST['cancel']) ? define('POST_CANCEL', $_POST['cancel']): define('POST_CANCEL', '');
+isset($_POST['hash']) ? define('POST_HASH', $_POST['hash']): define('POST_HASH', '');
+isset($_POST['title']) ? define('POST_TITLE', $_POST['title']): define('POST_TITLE', '');
+isset($_POST['description']) ? define('POST_DESCRIPTION', $_POST['description']): define('POST_DESCRIPTION', '');
+
+// prevent cycle between personal and common edit page
+if(!isset($_POST['referrer'])) {
+ define('POST_REFERRER', '');
+} elseif(strpos($_POST['referrer'], ROOT.'edit.php') == 0) {
+ define('POST_REFERRER', createUrl('history', POST_HASH));
+} else {
+ define('POST_REFERRER', $_POST['referrer']);
+}
+
+
+list ($url, $hash) = explode('/', $_SERVER['PATH_INFO']);
+$template = 'bookmarkcommondescriptionedit.tpl';
+
+
+//permissions
+if(is_null($currentUser)) {
+ $tplVars['error'] = T_('Permission denied.');
+ $templateservice->loadTemplate('error.500.tpl', $tplVars);
+ exit();
+}
+
+if (POST_CONFIRM) {
+ if (strlen($hash)>0 &&
+ $cdservice->addBookmarkDescription(POST_HASH, stripslashes(POST_TITLE), stripslashes(POST_DESCRIPTION), $currentUser->getId(), time())
+ ) {
+ $tplVars['msg'] = T_('Bookmark common description updated');
+ header('Location: '. POST_REFERRER);
+ } else {
+ $tplVars['error'] = T_('Failed to update the bookmark common description');
+ $template = 'error.500.tpl';
+ }
+} elseif (POST_CANCEL) {
+ header('Location: '. POST_REFERRER);
+} else {
+ $bkm = $bookmarkservice->getBookmarkByHash($hash);
+
+ $tplVars['subtitle'] = T_('Edit Bookmark Common Description') .': '. $bkm['bAddress'];
+ $tplVars['formaction'] = $_SERVER['SCRIPT_NAME'] .'/'. $hash;
+ $tplVars['referrer'] = $_SERVER['HTTP_REFERER'];
+ $tplVars['hash'] = $hash;
+ $tplVars['description'] = $cdservice->getLastBookmarkDescription($hash);
+}
+$templateservice->loadTemplate($template, $tplVars);
+?>
diff --git a/www/bookmarks.php b/www/bookmarks.php
new file mode 100644
index 0000000..91d0999
--- /dev/null
+++ b/www/bookmarks.php
@@ -0,0 +1,292 @@
+<?php
+/***************************************************************************
+ Copyright (C) 2004 - 2006 Scuttle project
+ http://sourceforge.net/projects/scuttle/
+ http://scuttle.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ ***************************************************************************/
+
+require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
+$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
+$cacheservice =& ServiceFactory::getServiceInstance('CacheService');
+
+/* Managing all possible inputs */
+isset($_GET['action']) ? define('GET_ACTION', $_GET['action']): define('GET_ACTION', '');
+isset($_POST['submitted']) ? define('POST_SUBMITTED', $_POST['submitted']): define('POST_SUBMITTED', '');
+
+isset($_GET['title']) ? define('GET_TITLE', $_GET['title']): define('GET_TITLE', '');
+isset($_GET['address']) ? define('GET_ADDRESS', $_GET['address']): define('GET_ADDRESS', '');
+isset($_GET['description']) ? define('GET_DESCRIPTION', $_GET['description']): define('GET_DESCRIPTION', '');
+isset($_GET['privateNote']) ? define('GET_PRIVATENOTE', $_GET['privateNote']): define('GET_PRIVATENOTE', '');
+isset($_GET['tags']) ? define('GET_TAGS', $_GET['tags']): define('GET_TAGS', '');
+isset($_GET['copyOf']) ? define('GET_COPYOF', $_GET['copyOf']): define('GET_COPYOF', '');
+
+isset($_POST['title']) ? define('POST_TITLE', $_POST['title']): define('POST_TITLE', '');
+isset($_POST['address']) ? define('POST_ADDRESS', $_POST['address']): define('POST_ADDRESS', '');
+isset($_POST['description']) ? define('POST_DESCRIPTION', $_POST['description']): define('POST_DESCRIPTION', '');
+isset($_POST['privateNote']) ? define('POST_PRIVATENOTE', $_POST['privateNote']): define('POST_PRIVATENOTE', '');
+isset($_POST['status']) ? define('POST_STATUS', $_POST['status']): define('POST_STATUS', '');
+isset($_POST['tags']) ? define('POST_TAGS', $_POST['tags']): define('POST_TAGS', '');
+isset($_POST['referrer']) ? define('POST_REFERRER', $_POST['referrer']): define('POST_REFERRER', '');
+
+isset($_GET['popup']) ? define('GET_POPUP', $_GET['popup']): define('GET_POPUP', '');
+isset($_POST['popup']) ? define('POST_POPUP', $_POST['popup']): define('POST_POPUP', '');
+
+isset($_GET['page']) ? define('GET_PAGE', $_GET['page']): define('GET_PAGE', 0);
+isset($_GET['sort']) ? define('GET_SORT', $_GET['sort']): define('GET_SORT', '');
+
+
+
+if ((GET_ACTION == "add") && !$userservice->isLoggedOn()) {
+ $loginqry = str_replace("'", '%27', stripslashes($_SERVER['QUERY_STRING']));
+ header('Location: '. createURL('login', '?'. $loginqry));
+ exit();
+}
+
+if ($userservice->isLoggedOn()) {
+ $currentUser = $userservice->getCurrentObjectUser();
+ $currentUserID = $currentUser->getId();
+ $currentUsername = $currentUser->getUsername();
+}
+
+
+@list($url, $user, $cat) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL;
+
+
+$endcache = false;
+if ($usecache) {
+ // Generate hash for caching on
+ $hash = md5($_SERVER['REQUEST_URI'] . $user);
+
+ // Don't cache if its users' own bookmarks
+ if ($userservice->isLoggedOn()) {
+ if ($currentUsername != $user) {
+ // Cache for 5 minutes
+ $cacheservice->Start($hash);
+ $endcache = true;
+ }
+ } else {
+ // Cache for 30 minutes
+ $cacheservice->Start($hash, 1800);
+ $endcache = true;
+ }
+}
+
+$pagetitle = $rssCat = $catTitle = '';
+if ($user) {
+ if (is_int($user)) {
+ $userid = intval($user);
+ } else {
+ if (!($userinfo = $userservice->getUserByUsername($user))) {
+ $tplVars['error'] = sprintf(T_('User with username %s was not found'), $user);
+ $templateservice->loadTemplate('error.404.tpl', $tplVars);
+ exit();
+ } else {
+ $userid =& $userinfo['uId'];
+ }
+ }
+ $pagetitle .= ': '. $user;
+}
+if ($cat) {
+ $catTitle = ': '. str_replace('+', ' + ', $cat);
+
+ $catTitleWithUrls = ': ';
+ $titleTags = explode('+', filter($cat));
+ for($i = 0; $i<count($titleTags);$i++) {
+ $catTitleWithUrls.= $titleTags[$i].'<a href="'.createUrl('bookmarks', $user.'/'.aggregateTags($titleTags, '+', $titleTags[$i])).'" title="'.T_('Remove the tag from the selection').'">*</a> + ';
+ }
+ $catTitleWithUrls = substr($catTitleWithUrls, 0, strlen($catTitleWithUrls) - strlen(' + '));
+
+ $pagetitle .= $catTitleWithUrls;
+}
+else
+{
+ $catTitleWithUrls = '';
+}
+$pagetitle = substr($pagetitle, 2);
+
+// Header variables
+$tplVars['loadjs'] = true;
+
+// ADD A BOOKMARK
+$saved = false;
+$templatename = 'bookmarks.tpl';
+if ($userservice->isLoggedOn() && POST_SUBMITTED != '') {
+ if (!POST_TITLE || !POST_ADDRESS) {
+ $tplVars['error'] = T_('Your bookmark must have a title and an address');
+ $templatename = 'editbookmark.tpl';
+ } else {
+ $address = trim(POST_ADDRESS);
+ // If the bookmark exists already, edit the original
+ if ($bookmarkservice->bookmarkExists($address, $currentUserID)) {
+ $bookmark =& $bookmarkservice->getBookmarkByAddress($address);
+ header('Location: '. createURL('edit', $bookmark['bId']));
+ exit();
+ // If it's new, save it
+ } else {
+ $title = trim(POST_TITLE);
+ $description = trim(POST_DESCRIPTION);
+ $privateNote = trim(POST_PRIVATENOTE);
+ $status = intval(POST_STATUS);
+ $categories = trim(POST_TAGS);
+ $saved = true;
+ if ($bookmarkservice->addBookmark($address, $title, $description, $privateNote, $status, $categories)) {
+ if (POST_POPUP != '') {
+ $tplVars['msg'] = '<script type="text/javascript">window.close();</script>';
+ } else {
+ $tplVars['msg'] = T_('Bookmark saved') . ' <a href="javascript:history.go(-2)">'.T_('(Come back to previous page.)').'</a>';
+ // Redirection option
+ if ($GLOBALS['useredir']) {
+ $address = $GLOBALS['url_redir'] . $address;
+ }
+ }
+ } else {
+ $tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.');
+ $templatename = 'editbookmark.tpl';
+ $saved = false;
+ }
+ }
+ }
+}
+
+if (GET_ACTION == "add") {
+ // If the bookmark exists already, edit the original
+ if ($bookmarkservice->bookmarkExists(stripslashes(GET_ADDRESS), $currentUserID)) {
+ $bookmark =& $bookmarkservice->getBookmarks(0, NULL, $currentUserID, NULL, NULL, NULL, NULL, NULL, NULL, md5($bookmarkservice->normalize(stripslashes(GET_ADDRESS))));
+ $popup = (GET_POPUP!='') ? '?popup=1' : '';
+ header('Location: '. createURL('edit', $bookmark['bookmarks'][0]['bId'] . $popup));
+ exit();
+ }
+ $templatename = 'editbookmark.tpl';
+}
+
+if ($templatename == 'editbookmark.tpl') {
+ if ($userservice->isLoggedOn()) {
+ $tplVars['formaction'] = createURL('bookmarks', $currentUsername);
+ if (POST_SUBMITTED != '') {
+ $tplVars['row'] = array(
+ 'bTitle' => stripslashes(POST_TITLE),
+ 'bAddress' => stripslashes(POST_ADDRESS),
+ 'bDescription' => stripslashes(POST_DESCRIPTION),
+ 'bPrivateNote' => stripslashes(POST_PRIVATENOTE),
+ 'tags' => (POST_TAGS ? explode(',', stripslashes(POST_TAGS)) : array()),
+ 'bStatus' => 0,
+ );
+ $tplVars['tags'] = POST_TAGS;
+ } else {
+ if(GET_COPYOF != '') { //copy from bookmarks page
+ $tplVars['row'] = $bookmarkservice->getBookmark(GET_COPYOF, true);
+ if(!$currentUser->isAdmin()) {
+ $tplVars['row']['bPrivateNote'] = ''; //only admin can copy private note
+ }
+ }else { //copy from pop-up bookmarklet
+ $tplVars['row'] = array(
+ 'bTitle' => stripslashes(GET_TITLE),
+ 'bAddress' => stripslashes(GET_ADDRESS),
+ 'bDescription' => stripslashes(GET_DESCRIPTION),
+ 'bPrivateNote' => stripslashes(GET_PRIVATENOTE),
+ 'tags' => (GET_TAGS ? explode(',', stripslashes(GET_TAGS)) : array()),
+ 'bStatus' => 0
+ );
+ }
+
+ }
+ $title = T_('Add a Bookmark');
+ $tplVars['referrer'] = '';;
+ if (isset($_SERVER['HTTP_REFERER'])) {
+ $tplVars['referrer'] = $_SERVER['HTTP_REFERER'];
+ }
+ $tplVars['pagetitle'] = $title;
+ $tplVars['subtitle'] = $title;
+ $tplVars['btnsubmit'] = T_('Add Bookmark');
+ $tplVars['popup'] = (GET_POPUP!='') ? GET_POPUP : null;
+ } else {
+ $tplVars['error'] = T_('You must be logged in before you can add bookmarks.');
+ }
+} else if ($user && GET_POPUP == '') {
+
+ $tplVars['sidebar_blocks'] = array('watchstatus');
+
+ if (!$cat) { //user page without tags
+ $cat = NULL;
+ $tplVars['currenttag'] = NULL;
+ //$tplVars['sidebar_blocks'][] = 'menu2';
+ $tplVars['sidebar_blocks'][] = 'linked';
+ $tplVars['sidebar_blocks'][] = 'popular';
+ } else { //pages with tags
+ $rssCat = '/'. filter($cat, 'url');
+ $tplVars['currenttag'] = $cat;
+ $tplVars['sidebar_blocks'][] = 'tagactions';
+ //$tplVars['sidebar_blocks'][] = 'menu2';
+ $tplVars['sidebar_blocks'][] = 'linked';
+ $tplVars['sidebar_blocks'][] = 'related';
+ /*$tplVars['sidebar_blocks'][] = 'menu';*/
+ }
+ $tplVars['sidebar_blocks'][] = 'menu2';
+ $tplVars['popCount'] = 30;
+ //$tplVars['sidebar_blocks'][] = 'popular';
+
+ $tplVars['userid'] = $userid;
+ $tplVars['userinfo'] =& $userinfo;
+ $tplVars['user'] = $user;
+ $tplVars['range'] = 'user';
+
+ // Pagination
+ $perpage = getPerPageCount($currentUser);
+ if (intval(GET_PAGE) > 1) {
+ $page = GET_PAGE;
+ $start = ($page - 1) * $perpage;
+ } else {
+ $page = 0;
+ $start = 0;
+ }
+
+ // Set template vars
+ $tplVars['rsschannels'] = array(
+ array(filter($sitename .': '. $pagetitle), createURL('rss', filter($user, 'url') . $rssCat.'?sort='.getSortOrder()))
+ );
+
+ $tplVars['page'] = $page;
+ $tplVars['start'] = $start;
+ $tplVars['bookmarkCount'] = $start + 1;
+
+ $bookmarks =& $bookmarkservice->getBookmarks($start, $perpage, $userid, $cat, null, getSortOrder());
+ $tplVars['total'] = $bookmarks['total'];
+ $tplVars['bookmarks'] =& $bookmarks['bookmarks'];
+ $tplVars['cat_url'] = createURL('bookmarks', '%s/%s');
+ $tplVars['nav_url'] = createURL('bookmarks', '%s/%s%s');
+ if ($userservice->isLoggedOn() && $user == $currentUsername) {
+ $tplVars['pagetitle'] = T_('My Bookmarks') . $catTitle;
+ $tplVars['subtitle'] = T_('My Bookmarks') . $catTitleWithUrls;
+ } else {
+ $tplVars['pagetitle'] = $user.': '.$cat;
+ $tplVars['subtitle'] = $pagetitle;
+ }
+}
+
+$tplVars['summarizeLinkedTags'] = true;
+$tplVars['pageName'] = PAGE_BOOKMARKS;
+
+
+$templateservice->loadTemplate($templatename, $tplVars);
+
+if ($usecache && $endcache) {
+ // Cache output if existing copy has expired
+ $cacheservice->End($hash);
+}
+?>
diff --git a/www/edit.php b/www/edit.php
new file mode 100644
index 0000000..005493d
--- /dev/null
+++ b/www/edit.php
@@ -0,0 +1,121 @@
+<?php
+
+/***************************************************************************
+Copyright (C) 2004 - 2006 Scuttle project
+http://sourceforge.net/projects/scuttle/
+http://scuttle.org/
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+***************************************************************************/
+
+require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
+$bookmarkservice = & ServiceFactory :: getServiceInstance('BookmarkService');
+
+/* Managing all possible inputs */
+isset($_POST['submitted']) ? define('POST_SUBMITTED', $_POST['submitted']): define('POST_SUBMITTED', '');
+isset($_POST['delete']) ? define('POST_DELETE', $_POST['delete']): define('POST_DELETE', '');
+
+isset($_POST['title']) ? define('POST_TITLE', $_POST['title']): define('POST_TITLE', '');
+isset($_POST['address']) ? define('POST_ADDRESS', $_POST['address']): define('POST_ADDRESS', '');
+isset($_POST['description']) ? define('POST_DESCRIPTION', $_POST['description']): define('POST_DESCRIPTION', '');
+isset($_POST['privateNote']) ? define('POST_PRIVATENOTE', $_POST['privateNote']): define('POST_PRIVATENOTE', '');
+isset($_POST['status']) ? define('POST_STATUS', $_POST['status']): define('POST_STATUS', '');
+isset($_POST['tags']) ? define('POST_TAGS', $_POST['tags']): define('POST_TAGS', '');
+
+isset($_GET['popup']) ? define('GET_POPUP', $_GET['popup']): define('GET_POPUP', '');
+isset($_POST['popup']) ? define('POST_POPUP', $_POST['popup']): define('POST_POPUP', '');
+isset($_POST['referrer']) ? define('POST_REFERRER', $_POST['referrer']): define('POST_REFERRER', '');
+
+// Header variables
+$tplVars['pagetitle'] = T_('Edit Bookmark');
+$tplVars['subtitle'] = T_('Edit Bookmark');
+$tplVars['loadjs'] = true;
+
+list ($url, $bookmark) = explode('/', $_SERVER['PATH_INFO']);
+
+if (!($row = $bookmarkservice->getBookmark(intval($bookmark), true))) {
+ $tplVars['error'] = sprintf(T_('Bookmark with id %s not was not found'), $bookmark);
+ $templateservice->loadTemplate('error.404.tpl', $tplVars);
+ exit();
+} else {
+
+ if (!$bookmarkservice->editAllowed($row)) {
+ $tplVars['error'] = T_('You are not allowed to edit this bookmark');
+ $templateservice->loadTemplate('error.500.tpl', $tplVars);
+ exit();
+ } else if (POST_SUBMITTED != '') {
+
+
+
+ if (!POST_TITLE || !POST_ADDRESS) {
+ $tplVars['error'] = T_('Your bookmark must have a title and an address');
+ } else {
+ // Update bookmark
+ $bId = intval($bookmark);
+ $address = trim(POST_ADDRESS);
+ $title = trim(POST_TITLE);
+ $description = trim(POST_DESCRIPTION);
+ $privateNote = trim(POST_PRIVATENOTE);
+ $status = intval(POST_STATUS);
+ $tags = trim(POST_TAGS);
+
+ if (!$bookmarkservice->updateBookmark($bId, $address, $title, $description, $privateNote, $status, $tags)) {
+ $tplvars['error'] = T_('Error while saving your bookmark');
+ } else {
+ if (POST_POPUP != '') {
+ //$tplVars['msg'] = (POST_POPUP != '') ? '<script type="text/javascript">window.close();</script>' : T_('Bookmark saved');
+ $tplVars['msg'] = '<script type="text/javascript">window.close();</script>';
+ } elseif (POST_REFERRER != '') {
+ $tplVars['msg'] = T_('Bookmark saved');
+ header('Location: '. POST_REFERRER);
+ } else {
+ $tplVars['msg'] = T_('Bookmark saved');
+ header('Location: '. createURL('bookmarks', $currentUser->getUsername()));
+ }
+ }
+ }
+ } else {
+ if (POST_DELETE != '') {
+ // Delete bookmark
+ if ($bookmarkservice->deleteBookmark($bookmark)) {
+ if (POST_POPUP != '') {
+ $tplVars['msg'] = '<script type="text/javascript">window.close();</script>';
+ } elseif (POST_REFERRER != '') {
+ header('Location: '. POST_REFERRER);
+ } else {
+ header('Location: '. createURL('bookmarks', $currentUser->getUsername()));
+ }
+ } else {
+ $tplVars['error'] = T_('Failed to delete bookmark');
+ $templateservice->loadTemplate('error.500.tpl', $tplVars);
+ exit();
+ }
+ }
+ }
+
+ $tplVars['popup'] = (GET_POPUP) ? GET_POPUP : null;
+ $tplVars['row'] =& $row;
+ $tplVars['formaction'] = createURL('edit', $bookmark);
+ $tplVars['btnsubmit'] = T_('Save Changes');
+ $tplVars['showdelete'] = true;
+ $tplVars['referrer'] = '';
+ if (isset($_SERVER['HTTP_REFERER'])) {
+ $tplVars['referrer'] = $_SERVER['HTTP_REFERER'];
+ }
+ $templateservice->loadTemplate('editbookmark.tpl', $tplVars);
+}
+?>
diff --git a/www/gsearch/context.php b/www/gsearch/context.php
new file mode 100644
index 0000000..e4599ad
--- /dev/null
+++ b/www/gsearch/context.php
@@ -0,0 +1,27 @@
+<?php
+require_once('../header.inc.php');
+
+if($GLOBALS['enableGoogleCustomSearch'] == false) {
+ echo "Google Custom Search disabled. You can enable it into the config.inc.php file.";
+ die;
+}
+?>
+
+<!--?xml version="1.0" encoding="UTF-8" ?-->
+<GoogleCustomizations>
+ <CustomSearchEngine>
+ <Title><?php echo $GLOBALS['sitename'] ?></Title>
+ <Description><?php echo filter($GLOBALS['welcomeMessage']) ?></Description>
+ <Context>
+ <BackgroundLabels>
+ <Label name="include" mode="FILTER" />
+ </BackgroundLabels>
+ </Context>
+ <LookAndFeel nonprofit="false">
+ </LookAndFeel>
+ </CustomSearchEngine>
+
+ <Include type="Annotations" href="<?php echo ROOT;?>api/export_gcs.php?xml=1" />
+
+
+</GoogleCustomizations>
diff --git a/www/gsearch/index.php b/www/gsearch/index.php
new file mode 100644
index 0000000..47839f4
--- /dev/null
+++ b/www/gsearch/index.php
@@ -0,0 +1,45 @@
+<?php require_once('../header.inc.php');
+
+if($GLOBALS['enableGoogleCustomSearch']==false) {
+ echo "Google Custom Search disabled. You can enable it into the config.inc.php file.";
+ die;
+}
+
+?>
+
+<html>
+<title><?php echo $GLOBALS['sitename'] ?></title>
+<body>
+<center>
+<br />
+
+<!-- Google CSE Search Box Begins -->
+<form id="cref" action="http://www.google.com/cse">
+ <input type="hidden" name="cref" value="<?php echo ROOT;?>gsearch/context.php" />
+ <input type="text" name="q" size="40" />
+ <input type="submit" name="sa" value="Search" />
+</form>
+<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cref"></script>
+<!-- Google CSE Search Box Ends -->
+<small>Based on <a href="http://www.google.com/coop/cse/">Google Custom Search</a> over this <a href="<?php echo ROOT ?>api/export_gcs.php">list of websites</a> from <?php echo $GLOBALS['sitename'] ?>.</small>
+<br />
+<br />
+<small><a href="<?php echo ROOT?>"><?php echo T_('Come back to ').$GLOBALS['sitename'] ?>...</a></small>
+
+
+<?php if($userservice->isLoggedOn() && $currentUser->isAdmin()){
+ 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 T_('If no result appears, check that all the urls are valid in the admin section.');
+ echo '</small></p>';
+
+}
+?>
+
+</center>
+</body>
+</html>
+
+
diff --git a/www/history.php b/www/history.php
new file mode 100644
index 0000000..b676515
--- /dev/null
+++ b/www/history.php
@@ -0,0 +1,93 @@
+<?php
+/***************************************************************************
+Copyright (C) 2006 Scuttle project
+http://sourceforge.net/projects/scuttle/
+http://scuttle.org/
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+***************************************************************************/
+
+require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
+$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
+$cacheservice =& ServiceFactory::getServiceInstance('CacheService');
+
+/* Managing all possible inputs */
+isset($_GET['page']) ? define('GET_PAGE', $_GET['page']): define('GET_PAGE', 0);
+isset($_GET['sort']) ? define('GET_SORT', $_GET['sort']): define('GET_SORT', '');
+
+@list($url, $hash) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL;
+
+
+
+if ($usecache) {
+ // Generate hash for caching on
+ $hashtext = $_SERVER['REQUEST_URI'];
+ if ($userservice->isLoggedOn()) {
+ $hashtext .= $currentUser->getUsername();
+ }
+ $cachehash = md5($hashtext);
+
+ // Cache for 30 minutes
+ $cacheservice->Start($cachehash, 1800);
+}
+
+// Pagination
+$perpage = getPerPageCount($currentUser);
+if (intval(GET_PAGE) > 1) {
+ $page = GET_PAGE;
+ $start = ($page - 1) * $perpage;
+} else {
+ $page = 0;
+ $start = 0;
+}
+
+if ($bookmark =& $bookmarkservice->getBookmarkByHash($hash)) {
+ // Template variables
+ $bookmarks =& $bookmarkservice->getBookmarks($start, $perpage, NULL, NULL, NULL, getSortOrder(), NULL, NULL, NULL, $hash);
+ $tplVars['pagetitle'] = T_('History') .': '. $bookmark['bAddress'];
+ $tplVars['subtitle'] = sprintf(T_('History for %s'), $bookmark['bAddress']);
+ $tplVars['loadjs'] = true;
+ $tplVars['page'] = $page;
+ $tplVars['start'] = $start;
+ $tplVars['bookmarkCount'] = $start + 1;
+ $tplVars['total'] = $bookmarks['total'];
+ $tplVars['bookmarks'] =& $bookmarks['bookmarks'];
+ $tplVars['hash'] = $hash;
+ $tplVars['popCount'] = 50;
+ $tplVars['sidebar_blocks'] = array('common');
+ //$tplVars['cat_url'] = createURL('tags', '%2$s');
+ $tplVars['cat_url'] = createURL('bookmarks', '%1$s/%2$s');
+ $tplVars['nav_url'] = createURL('history', $hash .'/%3$s');
+ $tplVars['rsschannels'] = array();
+ if($userservice->isLoggedOn()) {
+ $tplVars['user'] = $currentUser->getUsername();
+ } else {
+ $tplVars['user'] = '';
+ }
+ $templateservice->loadTemplate('bookmarks.tpl', $tplVars);
+} else {
+ // Throw a 404 error
+ $tplVars['error'] = T_('Address was not found');
+ $templateservice->loadTemplate('error.404.tpl', $tplVars);
+ exit();
+}
+
+if ($usecache) {
+ // Cache output if existing copy has expired
+ $cacheservice->End($cachehash);
+}
+?>
diff --git a/www/icon.png b/www/icon.png
new file mode 100644
index 0000000..be864a7
--- /dev/null
+++ b/www/icon.png
Binary files differ
diff --git a/www/images/b_edit.png b/www/images/b_edit.png
new file mode 100644
index 0000000..05711a0
--- /dev/null
+++ b/www/images/b_edit.png
Binary files differ
diff --git a/www/images/bg_admin.png b/www/images/bg_admin.png
new file mode 100644
index 0000000..c707779
--- /dev/null
+++ b/www/images/bg_admin.png
Binary files differ
diff --git a/www/images/bg_bar.png b/www/images/bg_bar.png
new file mode 100644
index 0000000..7152ba1
--- /dev/null
+++ b/www/images/bg_bar.png
Binary files differ
diff --git a/www/images/bg_header.png b/www/images/bg_header.png
new file mode 100644
index 0000000..6fa4161
--- /dev/null
+++ b/www/images/bg_header.png
Binary files differ
diff --git a/www/images/bg_sidebar.png b/www/images/bg_sidebar.png
new file mode 100644
index 0000000..0edb153
--- /dev/null
+++ b/www/images/bg_sidebar.png
Binary files differ
diff --git a/www/images/loading.gif b/www/images/loading.gif
new file mode 100644
index 0000000..859126e
--- /dev/null
+++ b/www/images/loading.gif
Binary files differ
diff --git a/www/images/logo.png b/www/images/logo.png
new file mode 100644
index 0000000..4afe565
--- /dev/null
+++ b/www/images/logo.png
Binary files differ
diff --git a/www/images/logo_24.gif b/www/images/logo_24.gif
new file mode 100644
index 0000000..d5af64d
--- /dev/null
+++ b/www/images/logo_24.gif
Binary files differ
diff --git a/www/images/rss.gif b/www/images/rss.gif
new file mode 100644
index 0000000..094ba10
--- /dev/null
+++ b/www/images/rss.gif
Binary files differ
diff --git a/www/import.php b/www/import.php
new file mode 100644
index 0000000..d9ea009
--- /dev/null
+++ b/www/import.php
@@ -0,0 +1,116 @@
+<?php
+/***************************************************************************
+ Copyright (C) 2004 - 2006 Scuttle project
+ http://sourceforge.net/projects/scuttle/
+ http://scuttle.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ ***************************************************************************/
+
+require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
+// No specific services
+
+/* Managing all possible inputs */
+// First input is $_FILES
+// Other inputs
+isset($_POST['status']) ? define('POST_STATUS', $_POST['status']): define('POST_STATUS', '');
+
+
+if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['size'] > 0) {
+ $userinfo = $userservice->getCurrentObjectUser();
+
+ if (is_numeric(POST_STATUS)) {
+ $status = intval(POST_STATUS);
+ } else {
+ $status = 2;
+ }
+
+ $depth = array();
+ $xml_parser = xml_parser_create();
+ xml_set_element_handler($xml_parser, "startElement", "endElement");
+
+ if (!($fp = fopen($_FILES['userfile']['tmp_name'], "r")))
+ die(T_("Could not open XML input"));
+
+ while ($data = fread($fp, 4096)) {
+ if (!xml_parse($xml_parser, $data, feof($fp))) {
+ die(sprintf(T_("XML error: %s at line %d"),
+ xml_error_string(xml_get_error_code($xml_parser)),
+ xml_get_current_line_number($xml_parser)));
+ }
+ }
+ xml_parser_free($xml_parser);
+ header('Location: '. createURL('bookmarks', $userinfo->getUsername()));
+} else {
+ $templatename = 'importDelicious.tpl';
+ $tplVars['subtitle'] = T_('Import Bookmarks from del.icio.us');
+ $tplVars['formaction'] = createURL('import');
+ $templateservice->loadTemplate($templatename, $tplVars);
+}
+
+
+
+function startElement($parser, $name, $attrs) {
+ global $depth, $status, $tplVars, $userservice;
+
+ $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
+
+ if ($name == 'POST') {
+ while(list($attrTitle, $attrVal) = each($attrs)) {
+ switch ($attrTitle) {
+ case 'HREF':
+ $bAddress = $attrVal;
+ break;
+ case 'DESCRIPTION':
+ $bTitle = $attrVal;
+ break;
+ case 'EXTENDED':
+ $bDescription = $attrVal;
+ break;
+ case 'TIME':
+ $bDatetime = $attrVal;
+ break;
+ case 'TAG':
+ $tags = strtolower($attrVal);
+ break;
+ }
+ }
+ if ($bookmarkservice->bookmarkExists($bAddress, $userservice->getCurrentUserId())) {
+ $tplVars['error'] = T_('You have already submitted this bookmark.');
+ } else {
+ // Strangely, PHP can't work out full ISO 8601 dates, so we have to chop off the Z.
+ $bDatetime = substr($bDatetime, 0, -1);
+
+ // If bookmark claims to be from the future, set it to be now instead
+ if (strtotime($bDatetime) > time()) {
+ $bDatetime = gmdate('Y-m-d H:i:s');
+ }
+
+ if ($bookmarkservice->addBookmark($bAddress, $bTitle, $bDescription, '', $status, $tags, $bDatetime, true, true))
+ $tplVars['msg'] = T_('Bookmark imported.');
+ else
+ $tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.');
+ }
+ }
+ $depth[$parser]++;
+}
+
+function endElement($parser, $name) {
+ global $depth;
+ $depth[$parser]--;
+}
+?>
diff --git a/www/importNetscape.php b/www/importNetscape.php
new file mode 100644
index 0000000..4580429
--- /dev/null
+++ b/www/importNetscape.php
@@ -0,0 +1,126 @@
+<?php
+/***************************************************************************
+ Copyright (C) 2004 - 2006 Scuttle project
+ http://sourceforge.net/projects/scuttle/
+ http://scuttle.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ ***************************************************************************/
+
+require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
+$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
+
+
+/* Managing all possible inputs */
+// First input is $_FILES
+// Other inputs
+isset($_POST['status']) ? define('POST_STATUS', $_POST['status']): define('POST_STATUS', '');
+
+$countImportedBookmarks = 0;
+$tplVars['msg'] = '';
+
+if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['size'] > 0) {
+ $userinfo = $userservice->getCurrentObjectUser();
+
+ if (is_numeric(POST_STATUS)) {
+ $status = intval(POST_STATUS);
+ } else {
+ $status = 2;
+ }
+
+ // File handle
+ $html = file_get_contents($_FILES['userfile']['tmp_name']);
+
+ // Create link array
+ //preg_match_all('/<a\s+(.*?)\s*\/*>([^<]*)/si', $html, $matches);
+ preg_match_all('/<a\s+(.*?)>([^<]*?)<\/a>.*?(<dd>([^<]*)|<dt>)/si', $html, $matches);
+
+ //var_dump($matches);die();
+
+
+ $links = $matches[1];
+ $titles = $matches[2];
+ $descriptions = $matches[4];
+
+ $size = count($links);
+ for ($i = 0; $i < $size; $i++) {
+
+ // echo "<hr/>";
+ // echo $links[$i]."<br/>";
+
+ preg_match_all('/(\w*\s*=\s*"[^"]*")/', $links[$i], $attributes);
+ //$attributes = $attributes[0]; // we keep just one row
+
+ $bDatetime = ""; //bDateTime optional
+ $bCategories = ""; //bCategories optional
+
+ foreach ($attributes[0] as $attribute) {
+ $att = preg_split('/\s*=\s*/s', $attribute, 2);
+ $attrTitle = $att[0];
+
+ $attrVal = eregi_replace('"', '&quot;', preg_replace('/([\'"]?)(.*)\1/', '$2', $att[1]));
+
+ switch ($attrTitle) {
+ case "HREF":
+ $bAddress = $attrVal;
+ break;
+ case "ADD_DATE":
+ $bDatetime = gmdate('Y-m-d H:i:s', $attrVal);
+ break;
+ case "TAGS":
+ $bCategories = $attrVal;
+ break;
+ case "NOTE":
+ $bPrivateNote = $attrVal;
+ }
+ }
+ $bTitle = trim($titles[$i]);
+ $bDescription = trim($descriptions[$i]);
+
+ if ($bookmarkservice->bookmarkExists($bAddress, $userservice->getCurrentUserId())) {
+ $tplVars['error'] = T_('You have already submitted some of these bookmarks.');
+ } else {
+ // If bookmark is local (like javascript: or place: in Firefox3), do nothing
+ if(substr($bAddress, 0, 7) == "http://" || substr($bAddress, 0, 8) == "https://") {
+
+ // If bookmark claims to be from the future, set it to be now instead
+ if (strtotime($bDatetime) > time()) {
+ $bDatetime = gmdate('Y-m-d H:i:s');
+ }
+
+ if ($bookmarkservice->addBookmark($bAddress, $bTitle, $bDescription, $bPrivateNote, $status, $bCategories, $bDatetime, false, true)) {
+ $countImportedBookmarks++;
+ } else {
+ $tplVars['error'] = T_('There was an error saving your bookmark. Please try again or contact the administrator.');
+ }
+ }
+ }
+ }
+ //header('Location: '. createURL('bookmarks', $userinfo->getUsername()));
+ $templatename = 'importNetscape.tpl';
+ $tplVars['msg'].= T_('Bookmarks found: ').$size.' ';
+ $tplVars['msg'].= T_('Bookmarks imported: ').' '.$countImportedBookmarks;
+ $tplVars['subtitle'] = T_('Import Bookmarks from Browser File');
+ $tplVars['formaction'] = createURL('importNetscape');
+ $templateservice->loadTemplate($templatename, $tplVars);
+} else {
+ $templatename = 'importNetscape.tpl';
+ $tplVars['subtitle'] = T_('Import Bookmarks from Browser File');
+ $tplVars['formaction'] = createURL('importNetscape');
+ $templateservice->loadTemplate($templatename, $tplVars);
+}
+?>
diff --git a/www/importStructure.php b/www/importStructure.php
new file mode 100644
index 0000000..89780f5
--- /dev/null
+++ b/www/importStructure.php
@@ -0,0 +1,76 @@
+<?php
+/***************************************************************************
+ Copyright (C) 2004 - 2006 Scuttle project
+ http://sourceforge.net/projects/scuttle/
+ http://scuttle.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ ***************************************************************************/
+
+require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
+$tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService');
+
+/* Managing current logged user */
+$currentUser = $userservice->getCurrentObjectUser();
+
+
+/* Managing all possible inputs */
+// First input is $_FILES
+
+$tplVars['msg'] = '';
+
+if ($userservice->isLoggedOn() && sizeof($_FILES) > 0 && $_FILES['userfile']['size'] > 0) {
+ $userinfo = $userservice->getCurrentObjectUser();
+
+
+ // File handle
+ $html = file_get_contents($_FILES['userfile']['tmp_name']);
+
+ // Create link array
+ preg_match_all('/(.*?)\n/', $html, $matches);
+
+ //print_r($matches); die();
+
+ $fatherTag = '';
+ $countNewLinks = 0;
+ foreach($matches[1] as $match) {
+ if($match == '') {
+ // do nothing because void line
+ }elseif(substr($match, 0, 2) == '//') {
+ // do nothing because commentary
+ } elseif(substr($match, 0, 2) == ' ') {
+ // add as child of previous tag
+ if($fatherTag != '') {
+ $tag2tagservice->addLinkedTags($fatherTag, $match, '>', $currentUser->getId());
+ $countNewLinks++;
+ } else {
+ $tplVars['error'] = T_('Bad indentation'). ' '.$match;
+ }
+ } else{
+ $fatherTag = $match;
+ }
+ }
+ $tplVars['msg'] = T_('New links between tags: ').$countNewLinks;
+
+}
+
+$templatename = 'importStructure.tpl';
+$tplVars['subtitle'] = T_('Import Structure');
+$tplVars['formaction'] = createURL('importStructure');
+$templateservice->loadTemplate($templatename, $tplVars);
+
+?>
diff --git a/www/index.php b/www/index.php
new file mode 100644
index 0000000..df55b05
--- /dev/null
+++ b/www/index.php
@@ -0,0 +1,99 @@
+<?php
+/***************************************************************************
+ Copyright (C) 2004 - 2006 Scuttle project
+ http://sourceforge.net/projects/scuttle/
+ http://scuttle.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ ***************************************************************************/
+
+require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
+$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
+$cacheservice =& ServiceFactory::getServiceInstance('CacheService');
+
+/* Managing all possible inputs */
+isset($_GET['action']) ? define('GET_ACTION', $_GET['action']): define('GET_ACTION', '');
+isset($_GET['page']) ? define('GET_PAGE', $_GET['page']): define('GET_PAGE', 0);
+isset($_GET['sort']) ? define('GET_SORT', $_GET['sort']): define('GET_SORT', '');
+
+
+// Logout action
+if (GET_ACTION == "logout") {
+ $userservice->logout();
+ $tplVars['currentUser'] = null;
+ $tplvars['msg'] = T_('You have now logged out');
+}
+
+
+// Header variables
+$tplVars['loadjs'] = true;
+$tplVars['rsschannels'] = array(
+array(sprintf(T_('%s: Recent bookmarks'), $sitename), createURL('rss').'?sort='.getSortOrder())
+);
+
+if ($usecache) {
+ // Generate hash for caching on
+ $hashtext = $_SERVER['REQUEST_URI'];
+ if ($userservice->isLoggedOn()) {
+ $hashtext .= $userservice->getCurrentUserID();
+ }
+ $hash = md5($hashtext);
+
+ // Cache for 15 minutes
+ $cacheservice->Start($hash, 900);
+}
+
+// Pagination
+$perpage = getPerPageCount($currentUser);
+if (intval(GET_PAGE) > 1) {
+ $page = GET_PAGE;
+ $start = ($page - 1) * $perpage;
+} else {
+ $page = 0;
+ $start = 0;
+}
+
+$dtend = date('Y-m-d H:i:s', strtotime('tomorrow'));
+/*$dtstart = date('Y-m-d H:i:s', strtotime($dtend .' -'. $defaultRecentDays .' days'));*/
+
+$tplVars['page'] = $page;
+$tplVars['start'] = $start;
+$tplVars['popCount'] = 30;
+$tplVars['sidebar_blocks'] = $GLOBALS["index_sidebar_blocks"];
+$tplVars['range'] = 'all';
+$tplVars['pagetitle'] = T_('Store, share and tag your favourite links');
+$tplVars['subtitle'] = T_('All Bookmarks');
+$tplVars['bookmarkCount'] = $start + 1;
+
+$bookmarks =& $bookmarkservice->getBookmarks($start, $perpage, NULL, NULL, NULL, getSortOrder(), NULL, 0, $dtend);
+
+$tplVars['total'] = $bookmarks['total'];
+$tplVars['bookmarks'] =& $bookmarks['bookmarks'];
+$tplVars['cat_url'] = createURL('bookmarks', '%1$s/%2$s');
+$tplVars['nav_url'] = createURL('index', '%3$s');
+$tplVars['summarizeLinkedTags'] = true;
+$tplVars['pageName'] = PAGE_INDEX;
+$tplVars['user'] = '';
+$tplVars['currenttag'] = '';
+
+$templateservice->loadTemplate('bookmarks.tpl', $tplVars);
+
+if ($usecache) {
+ // Cache output if existing copy has expired
+ $cacheservice->End($hash);
+}
+?>
diff --git a/www/js/MultiComboBox.js b/www/js/MultiComboBox.js
new file mode 100644
index 0000000..b263c8b
--- /dev/null
+++ b/www/js/MultiComboBox.js
@@ -0,0 +1,72 @@
+/*
+ Copyright (c) 2004-2008, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+/* SemanticScuttle: This script is a light modification of dojox.form.MultiComboBox
+This fork allows specific use until DOJO 1.2.3 in Google CDN. */
+
+
+
+if(!dojo._hasResource["js.MultiComboBox"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["js.MultiComboBox"] = true;
+dojo.provide("js.MultiComboBox");
+dojo.experimental("js.MultiComboBox");
+dojo.require("dijit.form.ComboBox");
+dojo.require("dijit.form.ValidationTextBox");
+
+dojo.declare("js.MultiComboBox",
+ [dijit.form.ValidationTextBox, dijit.form.ComboBoxMixin],{
+ //
+ // summary: A ComboBox that accpets multiple inputs on a single line?
+ //
+ // delimiter: String
+ // The character to use to separate items in the ComboBox input
+ delimiter: ",",
+ _previousMatches: false,
+
+ _setValueAttr: function(value){
+ if (this.delimiter && value.length != 0){
+ value = value+this.delimiter+" ";
+ arguments[0] = this._addPreviousMatches(value);
+ }
+ this.inherited(arguments);
+ },
+
+ _addPreviousMatches: function(/* String */text){
+ if(this._previousMatches){
+ if(!text.match(new RegExp("^"+this._previousMatches))){
+ text = this._previousMatches+text;
+ }
+ }
+ text = this._cleanupDelimiters(text); // SScuttle: this line was moved
+ return text; // String
+ },
+
+ _cleanupDelimiters: function(/* String */text){
+ if(this.delimiter){
+ text = text.replace(new RegExp(" +"), " ");
+ text = text.replace(new RegExp("^ *"+this.delimiter+"* *"), "");
+ text = text.replace(new RegExp(this.delimiter+" *"+this.delimiter), this.delimiter);
+ }
+ return text;
+ },
+
+ _autoCompleteText: function(/* String */text){
+ arguments[0] = this._addPreviousMatches(text);
+ this.inherited(arguments);
+ },
+
+ _startSearch: function(/* String */text){
+ text = this._cleanupDelimiters(text);
+ var re = new RegExp("^.*"+this.delimiter+" *");
+
+ if((this._previousMatches = text.match(re))){
+ arguments[0] = text.replace(re, "");
+ }
+ this.inherited(arguments);
+ }
+});
+
+} \ No newline at end of file
diff --git a/www/jsScuttle.php b/www/jsScuttle.php
new file mode 100644
index 0000000..0e8b96a
--- /dev/null
+++ b/www/jsScuttle.php
@@ -0,0 +1,148 @@
+<?php
+header('Content-Type: text/javascript');
+require_once('header.inc.php');
+require_once('functions.inc.php');
+$player_root = ROOT .'includes/player/';
+?>
+
+function _playerAdd(anchor) {
+ var url = anchor.href;
+ var code = '<object type="application/x-shockwave-flash" data="<?php echo $player_root ?>musicplayer_f6.swf?song_url=' + url +'&amp;b_bgcolor=ffffff&amp;b_fgcolor=000000&amp;b_colors=0000ff,0000ff,ff0000,ff0000&buttons=<?php echo $player_root ?>load.swf,<?php echo $player_root ?>play.swf,<?php echo $player_root ?>stop.swf,<?php echo $player_root ?>error.swf" width="14" height="14">';
+ var code = code + '<param name="movie" value="<?php echo $player_root ?>musicplayer.swf?song_url=' + url +'&amp;b_bgcolor=ffffff&amp;b_fgcolor=000000&amp;b_colors=0000ff,0000ff,ff0000,ff0000&amp;buttons=<?php echo $player_root ?>load.swf,<?php echo $player_root ?>play.swf,<?php echo $player_root ?>stop.swf,<?php echo $player_root ?>error.swf" />';
+ var code = code + '</object>';
+ anchor.parentNode.innerHTML = code +' '+ anchor.parentNode.innerHTML;
+}
+
+String.prototype.trim = function() {
+ return this.replace(/^\s+|\s+$/g, '');
+};
+
+var deleted = false;
+function deleteBookmark(ele, input){
+ var confirmDelete = "<span><?php echo T_('Are you sure?') ?> <a href=\"#\" onclick=\"deleteConfirmed(this, " + input + ", \'\'); return false;\"><?php echo T_('Yes'); ?></a> - <a href=\"#\" onclick=\"deleteCancelled(this); return false;\"><?php echo T_('No'); ?></a></span>";
+ ele.style.display = 'none';
+ ele.parentNode.innerHTML = ele.parentNode.innerHTML + confirmDelete;
+}
+
+function deleteCancelled(ele) {
+ var del = previousElement(ele.parentNode);
+ del.style.display = 'inline';
+ ele.parentNode.parentNode.removeChild(ele.parentNode);
+ return false;
+}
+
+function deleteConfirmed(ele, input, response) {
+ //if (deleted == false) {
+ deleted = ele.parentNode.parentNode.parentNode.parentNode;
+ //}
+ var post = deleted;
+ post.className = 'xfolkentry deleted';
+ if (response != '') {
+ post.style.display = 'none';
+ deleted = false;
+ } else {
+ loadXMLDoc('<?php echo ROOT; ?>ajaxDelete.php?id=' + input);
+ post.style.display = 'none';
+ }
+}
+
+function previousElement(ele) {
+ ele = ele.previousSibling;
+ while (ele.nodeType != 1) {
+ ele = ele.previousSibling;
+ }
+ return ele;
+}
+
+function isAvailable(input, response){
+ var usernameField = document.getElementById("username");
+ var username = usernameField.value;
+ username = username.toLowerCase();
+ username = username.trim();
+ var availability = document.getElementById("availability");
+ if (username != '') {
+ usernameField.style.backgroundImage = 'url(<?php echo ROOT; ?>images/loading.gif)';
+ if (response != '') {
+ usernameField.style.backgroundImage = 'none';
+ if (response == 'true') {
+ availability.className = 'available';
+ availability.innerHTML = '<?php echo T_('Available'); ?>';
+ } else {
+ availability.className = 'not-available';
+ availability.innerHTML = '<?php echo T_('Not Available'); ?>';
+ }
+ } else {
+ loadXMLDoc('<?php echo ROOT; ?>ajaxIsAvailable.php?username=' + username);
+ }
+ }
+}
+
+function useAddress(ele) {
+ var address = ele.value;
+ if (address != '') {
+ if (address.indexOf(':') < 0) {
+ address = 'http:\/\/' + address;
+ }
+ getTitle(address, null);
+ ele.value = address;
+ }
+}
+
+function getTitle(input, response){
+ var title = document.getElementById('titleField');
+ if (title.value == '') {
+ title.style.backgroundImage = 'url(<?php echo ROOT; ?>images/loading.gif)';
+ if (response != null) {
+ title.style.backgroundImage = 'none';
+ title.value = response;
+ } else if (input.indexOf('http') > -1) {
+ loadXMLDoc('<?php echo ROOT; ?>ajaxGetTitle.php?url=' + input);
+ } else {
+ return false;
+ }
+ }
+}
+
+var xmlhttp;
+function loadXMLDoc(url) {
+ // Native
+ if (window.XMLHttpRequest) {
+ xmlhttp = new XMLHttpRequest();
+ xmlhttp.onreadystatechange = processStateChange;
+ xmlhttp.open("GET", url, true);
+ xmlhttp.send(null);
+ // ActiveX
+ } else if (window.ActiveXObject) {
+ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
+ if (xmlhttp) {
+ xmlhttp.onreadystatechange = processStateChange;
+ xmlhttp.open("GET", url, true);
+ xmlhttp.send();
+ }
+ }
+}
+
+function processStateChange() {
+ if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
+ response = xmlhttp.responseXML.documentElement;
+ method = response.getElementsByTagName('method')[0].firstChild.data;
+ result = response.getElementsByTagName('result')[0].firstChild.data;
+ eval(method + '(\'\', result)');
+ }
+}
+
+function playerLoad() {
+ var anchors = document.getElementsByTagName('a');
+ var anchors_length = anchors.length;
+ for (var i = 0; i < anchors_length; i++) {
+ if (anchors[i].className == 'taggedlink' && anchors[i].href.match(/\.mp3$/i)) {
+ _playerAdd(anchors[i]);
+ }
+ }
+}
+
+function addAnchor(anchorForm, where) {
+ var whereZone = document.getElementById(where);
+ whereZone.value = whereZone.value + anchorForm;
+ document.getElementById(where).focus();
+}
diff --git a/www/login.php b/www/login.php
new file mode 100644
index 0000000..0fa820c
--- /dev/null
+++ b/www/login.php
@@ -0,0 +1,62 @@
+<?php
+/***************************************************************************
+Copyright (C) 2004 - 2006 Scuttle project
+http://sourceforge.net/projects/scuttle/
+http://scuttle.org/
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+***************************************************************************/
+
+require_once('header.inc.php');
+
+
+/* Service creation: only useful services are created */
+// No specific services
+
+
+/* Managing all possible inputs */
+isset($_POST['keeppass']) ? define('POST_KEEPPASS', $_POST['keeppass']): define('POST_KEEPPASS', '');
+isset($_POST['submitted']) ? define('POST_SUBMITTED', $_POST['submitted']): define('POST_SUBMITTED', '');
+isset($_POST['username']) ? define('POST_USERNAME', $_POST['username']): define('POST_USERNAME', '');
+isset($_POST['password']) ? define('POST_PASSWORD', $_POST['password']): define('POST_PASSWORD', '');
+isset($_POST['query']) ? define('POST_QUERY', $_POST['query']): define('POST_QUERY', '');
+
+$keeppass = (POST_KEEPPASS=='yes')?true:false;
+
+$login = false;
+if (POST_SUBMITTED!='' && POST_USERNAME!='' && POST_PASSWORD!='') {
+ $posteduser = trim(utf8_strtolower(POST_USERNAME));
+ $login = $userservice->login($posteduser, POST_PASSWORD, $keeppass);
+ if ($login) {
+ if (POST_QUERY)
+ header('Location: '. createURL('bookmarks', $posteduser .'?'. POST_QUERY));
+ else
+ header('Location: '. createURL('bookmarks', $posteduser));
+ } else {
+ $tplVars['error'] = T_('The details you have entered are incorrect. Please try again.');
+ }
+}
+if (!$login) {
+ if ($userservice->isLoggedOn()) {
+ $cUser = $userservice->getCurrentObjectUser();
+ header('Location: '. createURL('bookmarks', strtolower($cUser->getUsername())));
+ }
+
+ $tplVars['subtitle'] = T_('Log In');
+ $tplVars['formaction'] = createURL('login');
+ $tplVars['querystring'] = filter($_SERVER['QUERY_STRING']);
+ $templateservice->loadTemplate('login.tpl', $tplVars);
+}
+?>
diff --git a/www/password.php b/www/password.php
new file mode 100644
index 0000000..ba7be8d
--- /dev/null
+++ b/www/password.php
@@ -0,0 +1,78 @@
+<?php
+/***************************************************************************
+ Copyright (C) 2005 Scuttle project
+ https://sourceforge.net/projects/scuttle/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ ***************************************************************************/
+
+require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
+// No specific services
+
+/* Managing all possible inputs */
+isset($_POST['submitted']) ? define('POST_SUBMITTED', $_POST['submitted']): define('POST_SUBMITTED', '');
+isset($_POST['username']) ? define('POST_USERNAME', $_POST['username']): define('POST_USERNAME', '');
+isset($_POST['email']) ? define('POST_EMAIL', $_POST['email']): define('POST_EMAIL', '');
+
+// IF SUBMITTED
+if (POST_SUBMITTED != '') {
+
+ // NO USERNAME
+ if (!POST_USERNAME) {
+ $tplVars['error'] = T_('You must enter your username.');
+
+ // NO E-MAIL
+ } elseif (!POST_EMAIL) {
+ $tplVars['error'] = T_('You must enter your <abbr title="electronic mail">e-mail</abbr> address.');
+
+ // USERNAME AND E-MAIL
+ } else {
+
+ // NO MATCH
+ $userinfo = $userservice->getObjectUserByUsername(POST_USERNAME);
+ if ($userinfo == NULL) {
+ $tplVars['error'] = T_('No matches found for that username.');
+
+ } elseif (POST_EMAIL != $userinfo->getEmail()) {
+ $tplVars['error'] = T_('No matches found for that combination of username and <abbr title="electronic mail">e-mail</abbr> address.');
+
+ // MATCH
+ } else {
+
+ // GENERATE AND STORE PASSWORD
+ $password = $userservice->generatePassword($userinfo->getId());
+ if (!($password = $userservice->generatePassword($userinfo->getId()))) {
+ $tplVars['error'] = T_('There was an error while generating your new password. Please try again.');
+
+ } else {
+ // SEND E-MAIL
+ $message = T_('Your new password is:') ."\n". $password ."\n\n". T_('To keep your bookmarks secure, you should change this password in your profile the next time you log in.');
+ $message = wordwrap($message, 70);
+ $headers = 'From: '. $adminemail;
+ $mail = mail(POST_EMAIL, sprintf(T_('%s Account Information'), $sitename), $message);
+
+ $tplVars['msg'] = sprintf(T_('New password generated and sent to %s'), POST_EMAIL);
+ }
+ }
+ }
+}
+
+$templatename = 'password.tpl';
+$tplVars['subtitle'] = T_('Forgotten Password');
+$tplVars['formaction'] = createURL('password');
+$templateservice->loadTemplate($templatename, $tplVars);
+?>
diff --git a/www/player/error.swf b/www/player/error.swf
new file mode 100644
index 0000000..fc440f3
--- /dev/null
+++ b/www/player/error.swf
Binary files differ
diff --git a/www/player/license.txt b/www/player/license.txt
new file mode 100644
index 0000000..2111a50
--- /dev/null
+++ b/www/player/license.txt
@@ -0,0 +1,10 @@
+Copyright (c) 2005, Fabricio Zuardi
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/www/player/load.swf b/www/player/load.swf
new file mode 100644
index 0000000..6da4ce6
--- /dev/null
+++ b/www/player/load.swf
Binary files differ
diff --git a/www/player/musicplayer_f6.swf b/www/player/musicplayer_f6.swf
new file mode 100644
index 0000000..2eb5d57
--- /dev/null
+++ b/www/player/musicplayer_f6.swf
Binary files differ
diff --git a/www/player/play.swf b/www/player/play.swf
new file mode 100644
index 0000000..95415a6
--- /dev/null
+++ b/www/player/play.swf
Binary files differ
diff --git a/www/player/stop.swf b/www/player/stop.swf
new file mode 100644
index 0000000..e66556d
--- /dev/null
+++ b/www/player/stop.swf
Binary files differ
diff --git a/www/populartags.php b/www/populartags.php
new file mode 100644
index 0000000..6429bf7
--- /dev/null
+++ b/www/populartags.php
@@ -0,0 +1,84 @@
+<?php
+/***************************************************************************
+ Copyright (C) 2004 - 2006 Scuttle project
+ http://sourceforge.net/projects/scuttle/
+ http://scuttle.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ ***************************************************************************/
+
+require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
+$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
+$cacheservice =& ServiceFactory::getServiceInstance('CacheService');
+
+@list($url, $user) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL;
+
+if ($usecache) {
+ // Generate hash for caching on
+ $hashtext = $_SERVER['REQUEST_URI'];
+ if ($userservice->isLoggedOn()) {
+ $hashtext .= $currentUser->getId();
+ if ($currentUser->getUsername() == $user) {
+ $hashtext .= $user;
+ }
+ }
+ $hash = md5($hashtext);
+
+ // Cache for an hour
+ $cacheservice->Start($hash, 3600);
+}
+
+// Header variables
+$pagetitle = T_('Popular Tags');
+
+if (isset($user) && $user != '') {
+
+ $userid = $userservice->getIdFromUser($user);
+ if($userid == NULL) {
+ $tplVars['error'] = sprintf(T_('User with username %s was not found'), $user);
+ $templateservice->loadTemplate('error.404.tpl', $tplVars);
+ //throw a 404 error
+ exit();
+ }
+
+ $pagetitle .= ': '. ucfirst($user);
+} else {
+ $userid = NULL;
+}
+
+$tags = $b2tservice->getPopularTags($userid, 150);
+$tplVars['tags'] =& $b2tservice->tagCloud($tags, 5, 90, 225, getSortOrder('alphabet_asc'));
+$tplVars['user'] = $user;
+
+if (isset($userid)) {
+ $tplVars['cat_url'] = createURL('bookmarks', '%s/%s');
+} else {
+ $tplVars['cat_url'] = createURL('tags', '%2$s');
+}
+
+$tplVars['sidebar_blocks'] = array('linked');
+$tplVars['pagetitle'] = $pagetitle;
+$tplVars['subtitle'] = $pagetitle;
+$tplVars['loadjs'] = true;
+
+$templateservice->loadTemplate('tags.tpl', $tplVars);
+
+if ($usecache) {
+ // Cache output if existing copy has expired
+ $cacheservice->End($hash);
+}
+?>
diff --git a/www/profile.php b/www/profile.php
new file mode 100644
index 0000000..2d00101
--- /dev/null
+++ b/www/profile.php
@@ -0,0 +1,129 @@
+<?php
+/***************************************************************************
+ Copyright (C) 2004 - 2006 Scuttle project
+ http://sourceforge.net/projects/scuttle/
+ http://scuttle.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ ***************************************************************************/
+
+require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
+// No specific services
+
+/* Managing all possible inputs */
+isset($_POST['submitted']) ? define('POST_SUBMITTED', $_POST['submitted']): define('POST_SUBMITTED', '');
+isset($_POST['pPass']) ? define('POST_PASS', $_POST['pPass']): define('POST_PASS', '');
+isset($_POST['pPassConf']) ? define('POST_PASSCONF', $_POST['pPassConf']): define('POST_PASSCONF', '');
+isset($_POST['pName']) ? define('POST_NAME', $_POST['pName']): define('POST_NAME', '');
+isset($_POST['pMail']) ? define('POST_MAIL', $_POST['pMail']): define('POST_MAIL', '');
+isset($_POST['pPage']) ? define('POST_PAGE', $_POST['pPage']): define('POST_PAGE', '');
+isset($_POST['pDesc']) ? define('POST_DESC', $_POST['pDesc']): define('POST_DESC', '');
+
+isset($_POST['token']) ? define('POST_TOKEN', $_POST['token']): define('POST_TOKEN', '');
+isset($_SESSION['token']) ? define('SESSION_TOKEN', $_SESSION['token']): define('SESSION_TOKEN', '');
+isset($_SESSION['token_stamp']) ? define('SESSION_TOKENSTAMP', $_SESSION['token_stamp']): define('SESSION_TOKENSTAMP', '');
+
+
+@list($url, $user) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL;
+
+if ($user) {
+
+ if (is_int($user)) {
+ $userid = intval($user);
+ } else {
+ $user = urldecode($user);
+ $userinfo = $userservice->getObjectUserByUsername($user);
+ if ($userinfo == NULL) {
+ $tplVars['error'] = sprintf(T_('User with username %s was not found'), $user);
+ $templateservice->loadTemplate('error.404.tpl', $tplVars);
+ exit();
+ } else {
+ $userid =& $userinfo->getId();
+ }
+ }
+} else {
+ $tplVars['error'] = T_('Username was not specified');
+ $templateservice->loadTemplate('error.404.tpl', $tplVars);
+ exit();
+}
+
+if ($userservice->isLoggedOn() && $user == $currentUser->getUsername()) {
+ $title = T_('My Profile');
+} else {
+ $title = T_('Profile') .': '. $user;
+}
+$tplVars['pagetitle'] = $title;
+$tplVars['subtitle'] = $title;
+
+$tplVars['user'] = $user;
+$tplVars['userid'] = $userid;
+
+if (POST_SUBMITTED!='' && $currentUser->getId() == $userid) {
+ $error = false;
+ $detPass = trim(POST_PASS);
+ $detPassConf = trim(POST_PASSCONF);
+ $detName = trim(POST_NAME);
+ $detMail = trim(POST_MAIL);
+ $detPage = trim(POST_PAGE);
+ $detDesc = filter(POST_DESC);
+
+ // manage token preventing from CSRF vulnaribilities
+ if ( SESSION_TOKEN == ''
+ || time() - SESSION_TOKENSTAMP > 600 //limit token lifetime, optionnal
+ || SESSION_TOKEN != POST_TOKEN) {
+ $error = true;
+ $tplVars['error'] = T_('Invalid Token');
+ }
+
+ if ($detPass != $detPassConf) {
+ $error = true;
+ $tplVars['error'] = T_('Password and confirmation do not match.');
+ }
+ if ($detPass != "" && strlen($detPass) < 6) {
+ $error = true;
+ $tplVars['error'] = T_('Password must be at least 6 characters long.');
+ }
+ if (!$userservice->isValidEmail($detMail)) {
+ $error = true;
+ $tplVars['error'] = T_('E-mail address is not valid.');
+ }
+ if (!$error) {
+ if (!$userservice->updateUser($userid, $detPass, $detName, $detMail, $detPage, $detDesc)) {
+ $tplvars['error'] = T_('An error occurred while saving your changes.');
+ } else {
+ $tplVars['msg'] = T_('Changes saved.');
+ }
+ }
+ $userinfo = $userservice->getObjectUserByUsername($user);
+}
+
+if (!$userservice->isLoggedOn() || $currentUser->getId() != $userid) {
+ $templatename = 'profile.tpl.php';
+} else {
+ //Token Init
+ $_SESSION['token'] = md5(uniqid(rand(), true));
+ $_SESSION['token_stamp'] = time();
+
+ $templatename = 'editprofile.tpl.php';
+ $tplVars['formaction'] = createURL('profile', $user);
+ $tplVars['token'] = $_SESSION['token'];
+
+}
+
+$tplVars['objectUser'] = $userinfo;
+$templateservice->loadTemplate($templatename, $tplVars);
+?>
diff --git a/www/register.php b/www/register.php
new file mode 100644
index 0000000..3b64873
--- /dev/null
+++ b/www/register.php
@@ -0,0 +1,80 @@
+<?php
+/***************************************************************************
+Copyright (C) 2004 - 2006 Marcus Campbell
+http://sourceforge.net/projects/scuttle/
+http://scuttle.org/
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+***************************************************************************/
+
+require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
+// No specific services
+
+/* Managing all possible inputs */
+isset($_POST['submitted']) ? define('POST_SUBMITTED', $_POST['submitted']): define('POST_SUBMITTED', '');
+isset($_POST['username']) ? define('POST_USERNAME', $_POST['username']): define('POST_USERNAME', '');
+isset($_POST['password']) ? define('POST_PASS', $_POST['password']): define('POST_PASS', '');
+isset($_POST['email']) ? define('POST_MAIL', $_POST['email']): define('POST_MAIL', '');
+isset($_POST['antispamAnswer']) ? define('POST_ANTISPAMANSWER', $_POST['antispamAnswer']): define('POST_ANTISPAMANSWER', '');
+
+
+if (POST_SUBMITTED != '') {
+ $posteduser = trim(utf8_strtolower(POST_USERNAME));
+
+ // Check if form is incomplete
+ if (!($posteduser) || POST_PASS == '' || POST_MAIL == '') {
+ $tplVars['error'] = T_('You <em>must</em> enter a username, password and e-mail address.');
+
+ // Check if username is reserved
+ } elseif ($userservice->isReserved($posteduser)) {
+ $tplVars['error'] = T_('This username has been reserved, please make another choice.');
+
+ // Check if username already exists
+ } elseif ($userservice->getUserByUsername($posteduser)) {
+ $tplVars['error'] = T_('This username already exists, please make another choice.');
+
+ // Check if username is valid (length, authorized characters)
+ } elseif (!$userservice->isValidUsername($posteduser)) {
+ $tplVars['error'] = T_('This username is not valid (too short, too long, forbidden characters...), please make another choice.');
+
+ // Check if e-mail address is valid
+ } elseif (!$userservice->isValidEmail(POST_MAIL)) {
+ $tplVars['error'] = T_('E-mail address is not valid. Please try again.');
+
+ // Check if antispam answer is valid (doesn't take into account spaces and uppercase)
+ } elseif (strcasecmp(str_replace(' ', '', POST_ANTISPAMANSWER), str_replace(' ', '', $GLOBALS['antispamAnswer'])) != 0) {
+ $tplVars['error'] = T_('Antispam answer is not valid. Please try again.');
+
+ // Register details
+ } elseif ($userservice->addUser($posteduser, POST_PASS, POST_MAIL)) {
+ // Log in with new username
+ $login = $userservice->login($posteduser, POST_PASS);
+ if ($login) {
+ header('Location: '. createURL('bookmarks', $posteduser));
+ }
+ $tplVars['msg'] = T_('You have successfully registered. Enjoy!');
+ } else {
+ $tplVars['error'] = T_('Registration failed. Please try again.');
+ }
+}
+
+$tplVars['antispamQuestion'] = $GLOBALS['antispamQuestion'];
+$tplVars['loadjs'] = true;
+$tplVars['subtitle'] = T_('Register');
+$tplVars['formaction'] = createURL('register');
+$templateservice->loadTemplate('register.tpl', $tplVars);
+?>
diff --git a/www/rss.php b/www/rss.php
new file mode 100644
index 0000000..3a2b54a
--- /dev/null
+++ b/www/rss.php
@@ -0,0 +1,121 @@
+<?php
+/***************************************************************************
+ Copyright (C) 2004 - 2006 Scuttle project
+ http://sourceforge.net/projects/scuttle/
+ http://scuttle.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ ***************************************************************************/
+
+require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
+$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
+$cacheservice =& ServiceFactory::getServiceInstance('CacheService');
+
+
+header('Content-Type: application/xml');
+if(isset($_SERVER['PATH_INFO']) && strlen($_SERVER['PATH_INFO']) >1) {
+ list($url, $user, $cat) = explode('/', $_SERVER['PATH_INFO']);
+} else {
+ $url = '';
+ $user = '';
+ $cat = NULL;
+}
+
+if ($usecache) {
+ // Generate hash for caching on
+ $hashtext = $_SERVER['REQUEST_URI'];
+ if ($userservice->isLoggedOn()) {
+ $hashtext .= $userservice->getCurrentUserID();
+ if ($currentUser->getUsername() == $user) {
+ $hashtext .= $user;
+ }
+ }
+ $hash = md5($hashtext);
+
+ // Cache for an hour
+ $cacheservice->Start($hash, 3600);
+}
+
+$watchlist = null;
+$pagetitle = '';
+if ($user && $user != 'all') {
+ if ($user == 'watchlist') {
+ $user = $cat;
+ $cat = null;
+ $watchlist = true;
+ }
+ if (is_int($user)) {
+ $userid = intval($user);
+ } else {
+ if ($userinfo = $userservice->getUserByUsername($user)) {
+ $userid =& $userinfo[$userservice->getFieldName('primary')];
+ } else {
+ $tplVars['error'] = sprintf(T_('User with username %s was not found'), $user);
+ $templateservice->loadTemplate('error.404.tpl', $tplVars);
+ //throw a 404 error
+ exit();
+ }
+ }
+ $pagetitle .= ": ". $user;
+} else {
+ $userid = NULL;
+}
+
+if ($cat) {
+ $pagetitle .= ": ". str_replace('+', ' + ', $cat);
+}
+
+$tplVars['feedtitle'] = filter($GLOBALS['sitename'] . (isset($pagetitle) ? $pagetitle : ''));
+$tplVars['feedlink'] = ROOT;
+$tplVars['feeddescription'] = sprintf(T_('Recent bookmarks posted to %s'), $GLOBALS['sitename']);
+
+$bookmarks =& $bookmarkservice->getBookmarks(0, 15, $userid, $cat, NULL, getSortOrder(), $watchlist);
+
+$bookmarks_tmp =& filter($bookmarks['bookmarks']);
+
+$bookmarks_tpl = array();
+foreach(array_keys($bookmarks_tmp) as $key) {
+ $row =& $bookmarks_tmp[$key];
+
+ $_link = $row['bAddress'];
+ // Redirection option
+ if ($GLOBALS['useredir']) {
+ $_link = $GLOBALS['url_redir'] . $_link;
+ }
+ $_pubdate = gmdate("r", strtotime($row['bDatetime']));
+ // array_walk($row['tags'], 'filter');
+
+ $bookmarks_tpl[] = array(
+ 'title' => $row['bTitle'],
+ 'link' => $_link,
+ 'description' => $row['bDescription'],
+ 'creator' => $row['username'],
+ 'pubdate' => $_pubdate,
+ 'tags' => $row['tags']
+ );
+}
+unset($bookmarks_tmp);
+unset($bookmarks);
+$tplVars['bookmarks'] =& $bookmarks_tpl;
+
+$templateservice->loadTemplate('rss.tpl', $tplVars);
+
+if ($usecache) {
+ // Cache output if existing copy has expired
+ $cacheservice->End($hash);
+}
+?>
diff --git a/www/scuttle.css b/www/scuttle.css
new file mode 100644
index 0000000..5dd4dc5
--- /dev/null
+++ b/www/scuttle.css
@@ -0,0 +1,571 @@
+/* Watch out. This file bugs (in the header) when it is formated with Eclipse (Ctrl+Shift+F)*/
+
+/* BASE */
+
+* {
+ font-family: "trebuchet ms", tahoma, sans-serif;
+}
+a {
+ color: #47A;
+ text-decoration: none;
+}
+a:hover {
+ color: #258;
+ text-decoration: underline;
+}
+a img {
+ border: 0;
+}
+img.thumbnail { /* Thank you Ricco * */
+ border: 1px solid #AAAAAA;
+ float: left;
+ margin-bottom: 4px;
+ margin-right: 6px;
+ padding: 1px;
+}
+body {
+ margin: 0;
+ padding: 0;
+}
+input[type=text],
+input[type=password],
+select,
+textarea {
+ border: 1px solid #AAA;
+ padding: 0.1em;
+}
+input[type=text],
+input[type=password],
+textarea {
+ padding: 0.2em;
+}
+input[type=text]:focus,
+input[type=password]:focus,
+select:focus,
+textarea:focus {
+ border-color: #666;
+}
+p.tipMsg,
+p.error,
+p.success {
+ border: 1px solid;
+ font-size: small;
+ margin: 0.5em;
+ padding: 0.5em;
+ width: 70%;
+}
+p.tipMsg {
+ background: #FFFF99;
+ border-color: #CC9900;
+ color: #CC9900;
+}
+p.error {
+ background: #FCC;
+ border-color: #966;
+ color: #633;
+}
+p.success {
+ background: #CFC;
+ border-color: #696;
+ color: #363;
+}
+td#availability {
+ color: #285;
+ font-weight: bold;
+}
+td#availability.not-available {
+ color: #F00;
+}
+textarea {
+ font-size: small;
+ padding: 0.2em;
+}
+th {
+ padding-right: 1em;
+ text-align: right;
+}
+
+/* HEADER */
+
+div#header {
+ background: #FFF url('images/bg_header.png') bottom repeat-x;
+ border-bottom: 3px solid #9CD;
+ clear: both;
+}
+div#header:after {
+ content: ".";
+ display: block;
+ height: 0;
+ clear: both;
+ visibility: hidden;
+}
+* html div#header {
+ height: 1%;
+}
+h1 {
+ float: left;
+ font-size: x-large;
+ font-weight: bold;
+ letter-spacing: 0.25em;
+ margin: 0;
+ padding: 1em;
+ text-transform: lowercase;
+}
+html > body h1 {
+ background: url('images/logo.png') no-repeat 10px;
+ padding-left: 75px;
+}
+html > body div#header.popup h1 {
+ background: url('images/logo_24.gif') no-repeat 10px;
+ padding: 0.5em 0.5em 0.5em 50px;
+}
+/*html > body div#header #welcome {
+ position:absolute;
+ left:75px;
+}*/
+#welcome {
+ border: 10px solid #995;
+ width: 66%;
+ padding: 10px;
+ text-align:center;
+ font-size: medium;
+}
+#bottom {
+ padding-top: 10px;
+ text-align: center;
+ font-size: xx-small;
+}
+h1 a {
+ color: #000;
+}
+h1 a:hover {
+ color: #000;
+}
+h2 {
+ background: #666 url('images/bg_bar.png') center center repeat-x;
+ border-bottom: 3px solid #DDD;
+ clear: both;
+ color: #FFF;
+ font-size: medium;
+ letter-spacing: 0.1em;
+ margin: 0 0 1em 0;
+ padding: 0.5em 1em;
+ text-transform: lowercase;
+}
+h2 a, h2 a:hover {
+ color: #DDD;
+}
+
+/*sup {
+ color: #77ABE0;
+ font-weight: bold;
+}*/
+
+/* NAVIGATION */
+
+ul#navigation {
+ list-style-type: none;
+ margin: 0;
+ padding: 1.75em 1em;
+ text-transform: lowercase;
+ width: auto;
+}
+ul#navigation a {
+ font-size: medium;
+ font-weight: bold;
+ padding: 0.2em 0.5em;
+}
+ul#navigation a:hover {
+ background: #7AD;
+ color: #FFF;
+}
+ul#navigation li {
+ float: left;
+}
+ul#navigation li.access {
+ float: right;
+}
+
+/* BOOKMARKS */
+
+ol#bookmarks {
+ list-style-type: none;
+ margin: 0;
+ padding: 0 1em;
+ width: 70%;
+}
+html > body ol#bookmarks {
+ margin: 0 1em;
+ padding: 0;
+}
+img.thumbnail {
+ float: left;
+ padding: 1px;
+ margin-right: 6px;
+ margin-bottom:4px;
+ cursor:pointer;
+ border:1px solid #AAA;
+}
+div.link a {
+ color: blue;
+ font-size: medium;
+}
+div.link a:visited {
+ color: purple;
+}
+div.address {
+ color: #285;
+}
+div.meta {
+ color: #285;
+}
+div.meta span {
+ color: #F00;
+}
+div.privateNote {
+ font-variant: small-caps;
+ font-size: small;
+ text-align: right;
+}
+li.xfolkentry {
+ border-bottom: 1px solid #DDD;
+ margin-bottom: 0;
+ padding: 1em 0.5em;
+}
+html > body li.xfolkentry {
+ border-bottom: 1px dotted #AAA;
+}
+li.xfolkentry div {
+ padding: 0.1em;
+}
+li.xfolkentry.deleted {
+ opacity: 0.5;
+}
+li.xfolkentry.private {
+ border-left: 3px solid #F00;
+}
+li.xfolkentry.shared {
+ border-left: 3px solid #FA0;
+}
+
+li.xfolkentry div div.description span.anchorBookmark {
+ /*font-family:monospace;*/
+}
+
+/* SIDEBAR */
+
+div#sidebar {
+ font-size: small;
+ position: absolute;
+ right: 1em;
+ top: 10em;
+ width: 25%;
+}
+div#sidebar a {
+ color: #995;
+}
+div#sidebar a:hover {
+ color: #773;
+}
+div#sidebar>div {
+ background: #FFF url('images/bg_sidebar.png') bottom repeat-x;
+ border: 1px solid #CC8;
+ color: #555;
+ margin-bottom: 1em;
+}
+div#sidebar h2 {
+ background: transparent;
+ border: 0;
+ color: #995;
+ letter-spacing: 0;
+ margin: 0;
+ padding: 0.5em 0;
+}
+div#sidebar hr {
+ display: none;
+}
+div#sidebar p {
+ margin: 1em;
+}
+div#sidebar p.tags a {
+ margin: 0;
+}
+div#sidebar table {
+ margin: 0.5em 0.5em 0 0.5em;
+}
+div#sidebar table td {
+ padding-bottom: 0.25em;
+ padding-right: 0.5em;
+}
+div#sidebar ul {
+ list-style-type: none;
+ margin: 0;
+ padding: 0.5em;
+}
+div#sidebar ul li {
+ margin: 0.5em 0;
+}
+
+div#related {
+ padding: 0.5em;
+}
+
+.crossTags {
+ padding:0px 3px;
+ border: 1px solid #999955
+}
+
+div#sidebar>div#maintagsmenu {
+ padding: 0.5em;
+ border: 5px solid #999955
+}
+
+
+
+/* TAGS */
+
+p.commondescription {
+ padding-left:5px;
+ color: #555;
+ font-weight: bold;
+ font-size: medium;
+ border-left: 1px solid #CC8;
+ width: 70%;
+}
+
+p.tags {
+ line-height: 2.25em;
+ /*margin: 2em 10%;*/
+ text-align: justify;
+ vertical-align: middle;
+ width: 70%;
+}
+p.tags a,
+p.tags span {
+ color: #47A;
+ margin-right: 0.5em;
+}
+p.tags span:hover {
+ cursor: pointer;
+ text-decoration: underline;
+}
+p.tags span.selected {
+ background: #CEC;
+}
+
+.anchor {
+ cursor: pointer;
+ text-decoration: underline;
+}
+
+.treeTag {
+ color: #999955;
+}
+.treeTag:hover {
+ cursor: pointer;
+ text-decoration: underline;
+}
+.treeTag.selected {
+ background: #CEC;
+}
+
+/* PROFILE */
+
+table.profile th {
+ width: 10em;
+}
+
+/* OTHER GUFF */
+
+dd {
+ background: #CEC;
+ border-right: 4px solid #ACA;
+ color: #464;
+ padding: 6px;
+}
+dd a {
+ color: #464;
+}
+dd a:hover {
+ color: #000 !important;
+ text-decoration: underline !important;
+}
+
+dl {
+ font-size: small;
+ margin: 1em;
+ width: 70%;
+}
+dl#profile dd {
+ background: #CDE;
+ border-color: #ABC;
+ color: #247;
+}
+dl#profile dt {
+ background: #BCE;
+ border-color: #9AC;
+ color: #245;
+ display: block;
+ font-weight: bold;
+ padding: 6px;
+}
+dl#profile a {
+ color: #446;
+}
+dl#profile a:hover {
+ color: #000 !important;
+ text-decoration: underline !important;
+}
+dl#meta dd {
+ line-height: 1.5em;
+}
+dl#meta dt {
+ background: #BDB;
+ color: #353;
+ display: block;
+ font-weight: bold;
+ padding: 6px;
+}
+dt {
+ border-right: 4px solid #9B9;
+}
+dt a {
+ background: #BDB;
+ color: #353;
+ display: block;
+ font-weight: bold;
+ padding: 6px;
+}
+dt a:hover {
+ background: #ACA;
+ border: 0;
+}
+form {
+ margin: 0;
+}
+form#search {
+ margin-right: 0.75em;
+ color: #CCC;
+ font-size: small;
+ float: right;
+ margin: 0;
+ position: absolute;
+ right: 0;
+ top: 6.4em;
+}
+form label,
+form td,
+form th {
+ font-size: small;
+}
+form table {
+ margin: 0 1em;
+}
+h3 {
+ background: #DDD;
+ color: #555;
+ font-size: small;
+ letter-spacing: 0.2em;
+ margin: 2em 1em 1em 1em;
+ padding: 0.25em 0.75em;
+}
+li {
+ font-size: small;
+ margin-bottom: 0.5em;
+}
+p {
+ font-size: small;
+ margin: 1em;
+}
+p#sort {
+ /*color: #CCC;*/
+ font-size: small;
+ /*float: right;*/
+ /*margin: 0;*/
+ /*position: absolute;*/
+ right: 0;
+ top: 7em;
+}
+html > body p#sort {
+ /*margin-right: 0.75em;*/
+}
+p#sort a {
+ background: #AAA;
+ color: #555;
+ font-weight: normal;
+ margin-right: 0.5em;
+ padding: 0 1em;
+}
+html > body p#sort a {
+ margin-right: 0;
+}
+p#sort a:hover {
+ background: #CCC;
+ text-decoration: none !important;
+}
+p#sort span {
+ display: none;
+}
+
+p.backToTop{
+ text-align:center;
+}
+
+p.paging {
+ font-size: small;
+ margin-left: 1em;
+ text-align:center;
+}
+p.paging a,
+p.paging span.disable {
+ background: #888;
+ color: #FFF;
+ display: inline;
+ margin-right: 0.5em;
+ padding: 0.25em 1em;
+}
+p.paging a:hover {
+ background: #666;
+}
+p.paging span {
+ display: none;
+}
+p.paging span.disable {
+ background: #DDD;
+ color: #AAA;
+}
+div.collapsible p.tags {
+ line-height: 2.25em;
+ margin: 1em 2em;
+}
+th label {
+ padding-right: 1em;
+}
+ul {
+ margin-right: 1em;
+ width: 75%;
+}
+
+.adminBackground {
+ /*background: #FFFFFF url(images/logo_24.png) no-repeat scroll center right;*/
+ /*border-top: 1px solid;
+ border-color: #CC9900;*/
+}
+
+.adminBackground {
+ background: #FFF url('images/bg_admin.png') repeat-y top right;
+}
+
+a.bookmarklet {
+ padding: 2px;
+ background-color: #AAFAEE;
+}
+
+/* DOJO Style */
+
+/* DOJO Style */
+.scuttletheme .dijitInputField input,.scuttletheme .dijitTextBox,.scuttletheme .dijitComboBox,.scuttletheme .dijitSpinner
+ {
+ width: 100%;
+ margin: 0 0 0 0;
+}
diff --git a/www/search.php b/www/search.php
new file mode 100644
index 0000000..ce47236
--- /dev/null
+++ b/www/search.php
@@ -0,0 +1,136 @@
+<?php
+/***************************************************************************
+ Copyright (C) 2005 - 2006 Scuttle project
+ http://sourceforge.net/projects/scuttle/
+ http://scuttle.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ ***************************************************************************/
+
+require_once('header.inc.php');
+
+/* Managing all possible inputs */
+isset($_POST['terms']) ? define('POST_TERMS', $_POST['terms']): define('POST_TERMS', '');
+isset($_POST['range']) ? define('POST_RANGE', $_POST['range']): define('POST_RANGE', '');
+isset($_GET['page']) ? define('GET_PAGE', $_GET['page']): define('GET_PAGE', 0);
+isset($_GET['sort']) ? define('GET_SORT', $_GET['sort']): define('GET_SORT', '');
+
+
+// POST
+if (POST_TERMS != '') {
+ // Redirect to GET
+ header('Location: '. createURL('search', POST_RANGE .'/'. filter(POST_TERMS, 'url')));
+
+ // GET
+} else {
+ /* Service creation: only useful services are created */
+ $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
+ $searchhistoryservice =& ServiceFactory::getServiceInstance('SearchHistoryService');
+
+ /* Managing current logged user */
+ $currentUserId = $userservice->getCurrentUserId();
+
+
+ $exploded = isset($_SERVER['PATH_INFO'])
+ ? explode('/', $_SERVER['PATH_INFO']) : null;
+ if(count($exploded) == 4) {
+ list($url, $range, $terms, $page) = $exploded;
+ } else if (count($exploded) == 2) {
+ list($url, $range) = $exploded;
+ $terms = $page= NULL;
+ } else {
+ list($url, $range, $terms) = $exploded;
+ $page= NULL;
+ }
+
+ $tplVars['loadjs'] = true;
+
+ // Pagination
+ $perpage = getPerPageCount($currentUser);
+ if (intval(GET_PAGE) > 1) {
+ $page = GET_PAGE;
+ $start = ($page - 1) * $perpage;
+ } else {
+ $page = 0;
+ $start = 0;
+ }
+
+ $s_user = NULL;
+ $s_start = NULL;
+ $s_end = NULL;
+ $s_watchlist = NULL;
+
+ // No search terms
+ if (is_null($terms)) {
+ $tplVars['subtitle'] = T_('Search Bookmarks');
+ $s_end = date('Y-m-d H:i:s', strtotime('tomorrow'));
+ $s_start = date('Y-m-d H:i:s', strtotime($s_end .' -'. $defaultRecentDays .' days'));
+
+ // Search terms
+ } else {
+ $tplVars['subtitle'] = T_('Search Results');
+ $selected = ' selected="selected"';
+
+ switch ($range) {
+ case 'all':
+ $tplVars['select_all'] = $selected;
+ $s_user = NULL;
+ break;
+ case 'watchlist':
+ $tplVars['select_watchlist'] = $selected;
+ $s_user = $currentUserId;
+ $s_watchlist = true;
+ break;
+ default:
+ $s_user = $range;
+ break;
+ }
+
+ if (isset($s_user)) {
+ $tplVars['user'] = $range;
+ $s_user = $userservice->getIdFromUser($s_user);
+ if($s_user == NULL) {
+ $tplVars['error'] = sprintf(T_('User with username %s was not found'), $s_user);
+ $templateservice->loadTemplate('error.404.tpl', $tplVars);
+ exit();
+ }
+
+ }
+ }
+ $bookmarks =& $bookmarkservice->getBookmarks($start, $perpage, $s_user, NULL, $terms, getSortOrder(), $s_watchlist, $s_start, $s_end);
+
+ // Save search
+ $searchhistoryservice->addSearch($terms, $range, $bookmarks['total'], $currentUserId);
+
+ if($GLOBALS['enableGoogleCustomSearch']) {
+ $tplVars['tipMsg'] = T_('Unsatisfied? You can also try our ').'<a href="'.createUrl('gsearch/index').'">Google Custom Search page</a>.';
+ }
+ $tplVars['rsschannels'] = array();
+ $tplVars['page'] = $page;
+ $tplVars['start'] = $start;
+ $tplVars['popCount'] = 25;
+ $tplVars['sidebar_blocks'] = array('search', 'recent', 'menu2');
+ $tplVars['range'] = $range;
+ $tplVars['terms'] = $terms;
+ $tplVars['pagetitle'] = T_('Search Bookmarks');
+ $tplVars['bookmarkCount'] = $start + 1;
+ $tplVars['total'] = $bookmarks['total'];
+ $tplVars['bookmarks'] =& $bookmarks['bookmarks'];
+ $tplVars['cat_url'] = createURL('tags', '%2$s');
+ $tplVars['nav_url'] = createURL('search', $range .'/'. $terms .'/%3$s');
+
+ $templateservice->loadTemplate('bookmarks.tpl', $tplVars);
+}
+?>
diff --git a/www/tag2tagadd.php b/www/tag2tagadd.php
new file mode 100644
index 0000000..15ee6af
--- /dev/null
+++ b/www/tag2tagadd.php
@@ -0,0 +1,69 @@
+<?php
+/***************************************************************************
+Copyright (C) 2006 Scuttle project
+http://sourceforge.net/projects/scuttle/
+http://scuttle.org/
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+***************************************************************************/
+
+require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
+$tag2tagservice = & ServiceFactory :: getServiceInstance('Tag2TagService');
+
+/* Managing all possible inputs */
+isset($_POST['confirm']) ? define('POST_CONFIRM', $_POST['confirm']): define('POST_CONFIRM', '');
+isset($_POST['cancel']) ? define('POST_CANCEL', $_POST['cancel']): define('POST_CANCEL', '');
+isset($_POST['tag1']) ? define('POST_TAG1', $_POST['tag1']): define('POST_TAG1', '');
+isset($_POST['linkType']) ? define('POST_LINKTYPE', $_POST['linkType']): define('POST_LINKTYPE', '');
+isset($_POST['tag2']) ? define('POST_TAG2', $_POST['tag2']): define('POST_TAG2', '');
+
+
+//permissions
+if(!$userservice->isLoggedOn()) {
+ $tplVars['error'] = T_('Permission denied.');
+ $templateservice->loadTemplate('error.500.tpl', $tplVars);
+ exit();
+}
+
+/* Managing path info */
+list ($url, $tag1) = explode('/', $_SERVER['PATH_INFO']);
+
+if (POST_CONFIRM != '') {
+ $tag1 = POST_TAG1;
+ $linkType = POST_LINKTYPE;
+ $tag2 = POST_TAG2;
+ if ($tag2tagservice->addLinkedTags($tag1, $tag2, $linkType, $currentUser->getId())) {
+ $tplVars['msg'] = T_('Tag link created');
+ header('Location: '. createURL('bookmarks', $currentUser->getUsername()));
+ } else {
+ $tplVars['error'] = T_('Failed to create the link');
+ $templateservice->loadTemplate('error.500.tpl', $tplVars);
+ exit();
+ }
+} elseif (POST_CANCEL) {
+ header('Location: '. createURL('bookmarks', $currentUser->getUsername() .'/'. $tags));
+}
+
+$tplVars['links'] = $tag2tagservice->getLinks($currentUser->getId());
+
+$tplVars['tag1'] = $tag1;
+$tplVars['tag2'] = '';
+$tplVars['subtitle'] = T_('Add Tag Link') .': '. $tag1;
+$tplVars['formaction'] = $_SERVER['SCRIPT_NAME'] .'/'. $tag1;
+$tplVars['referrer'] = $_SERVER['HTTP_REFERER'];
+$templateservice->loadTemplate('tag2tagadd.tpl', $tplVars);
+?>
diff --git a/www/tag2tagdelete.php b/www/tag2tagdelete.php
new file mode 100644
index 0000000..78016e7
--- /dev/null
+++ b/www/tag2tagdelete.php
@@ -0,0 +1,85 @@
+<?php
+/***************************************************************************
+ Copyright (C) 2006 Scuttle project
+ http://sourceforge.net/projects/scuttle/
+ http://scuttle.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ ***************************************************************************/
+
+require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
+$tag2tagservice = & ServiceFactory :: getServiceInstance('Tag2TagService');
+
+/* Managing all possible inputs */
+isset($_POST['confirm']) ? define('POST_CONFIRM', $_POST['confirm']): define('POST_CONFIRM', '');
+isset($_POST['cancel']) ? define('POST_CANCEL', $_POST['cancel']): define('POST_CANCEL', '');
+isset($_POST['tag1']) ? define('POST_TAG1', $_POST['tag1']): define('POST_TAG1', '');
+isset($_POST['linkType']) ? define('POST_LINKTYPE', $_POST['linkType']): define('POST_LINKTYPE', '');
+isset($_POST['tag2']) ? define('POST_TAG2', $_POST['tag2']): define('POST_TAG2', '');
+
+isset($_SERVER['HTTP_REFERER']) ? define('HTTP_REFERER', $_SERVER['HTTP_REFERER']): define('HTTP_REFERER', '');
+
+/* Managing current logged user */
+$currentUser = $userservice->getCurrentObjectUser();
+
+//permissions
+if(!$userservice->isloggedOn()) {
+ $tplVars['error'] = T_('Permission denied.');
+ $templateservice->loadTemplate('error.500.tpl', $tplVars);
+ exit();
+}
+
+/* Managing path info */
+if(isset($_SERVER['PATH_INFO'])) {
+ $exploded = explode('/', $_SERVER['PATH_INFO']);
+ if(count($exploded) == 3) {
+ list ($url, $tag1, $tag2) = explode('/', $_SERVER['PATH_INFO']);
+ } else {
+ list ($url, $tag1) = explode('/', $_SERVER['PATH_INFO']);
+ $tag2 = '';
+ }
+} else {
+ $url = $tag1 = $tag2 = '';
+}
+
+
+
+if (POST_CONFIRM) {
+ $tag = POST_TAG1;
+ $linkType = POST_LINKTYPE;
+ $newTag = POST_TAG2;
+ if ($tag2tagservice->removeLinkedTags(POST_TAG1, POST_TAG2, POST_LINKTYPE, $currentUser->getId())) {
+ $tplVars['msg'] = T_('Tag link deleted');
+ header('Location: '. createURL('bookmarks', $currentUser->getUsername().'/'.$tag));
+ } else {
+ $tplVars['error'] = T_('Failed to delete the link');
+ $templateservice->loadTemplate('error.500.tpl', $tplVars);
+ exit();
+ }
+} elseif (POST_CANCEL) {
+ header('Location: '. createURL('bookmarks', $currentUser->getUsername() .'/'. $tags));
+}
+
+$tplVars['links'] = $tag2tagservice->getLinks($currentUser->getId());
+
+$tplVars['tag1'] = $tag1;
+$tplVars['tag2'] = $tag2;
+$tplVars['subtitle'] = T_('Delete Link Between Tags') .': '. $tag1.' > '.$tag2;
+$tplVars['formaction'] = $_SERVER['SCRIPT_NAME'];
+$tplVars['referrer'] = HTTP_REFERER;
+$templateservice->loadTemplate('tag2tagdelete.tpl', $tplVars);
+?>
diff --git a/www/tag2tagedit.php b/www/tag2tagedit.php
new file mode 100644
index 0000000..c707253
--- /dev/null
+++ b/www/tag2tagedit.php
@@ -0,0 +1,60 @@
+<?php
+/***************************************************************************
+Copyright (C) 2006 Scuttle project
+http://sourceforge.net/projects/scuttle/
+http://scuttle.org/
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+***************************************************************************/
+
+require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
+$tag2tagservice = & ServiceFactory :: getServiceInstance('Tag2TagService');
+
+
+/* Managing all possible inputs */
+isset($_SERVER['HTTP_REFERER']) ? define('HTTP_REFERER', $_SERVER['HTTP_REFERER']): define('HTTP_REFERER', '');
+
+//permissions
+if(!$userservice->loggedOn()) {
+ $tplVars['error'] = T_('Permission denied.');
+ $templateservice->loadTemplate('error.500.tpl', $tplVars);
+ exit();
+}
+
+/* Managing path info */
+if(isset($_SERVER['PATH_INFO'])) {
+ $exploded = explode('/', $_SERVER['PATH_INFO']);
+ if(count($exploded) == 3) {
+ list ($url, $tag1, $tag2) = explode('/', $_SERVER['PATH_INFO']);
+ } else {
+ list ($url, $tag1) = explode('/', $_SERVER['PATH_INFO']);
+ $tag2 = '';
+ }
+} else {
+ $url = $tag1 = $tag2 = '';
+}
+
+$tplVars['links'] = $tag2tagservice->getLinks($userservice->getCurrentUserId());
+
+$tplVars['tag1'] = $tag1;
+$tplVars['tag2'] = $tag2;
+$tplVars['subtitle'] = T_('Edit Link Between Tags') .': '. $tag1.' > '.$tag2;
+$tplVars['formaddaction'] = createUrl('tag2tagadd');
+$tplVars['formdeleteaction'] = createUrl('tag2tagdelete');
+$tplVars['referrer'] = HTTP_REFERER;
+$templateservice->loadTemplate('tag2tagedit.tpl', $tplVars);
+?>
diff --git a/www/tagcommondescriptionedit.php b/www/tagcommondescriptionedit.php
new file mode 100644
index 0000000..aba7c43
--- /dev/null
+++ b/www/tagcommondescriptionedit.php
@@ -0,0 +1,71 @@
+<?php
+/***************************************************************************
+ Copyright (C) 2006 - 2007 Scuttle project
+ http://sourceforge.net/projects/scuttle/
+ http://scuttle.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ ***************************************************************************/
+
+require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
+$b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService');
+$cdservice = & ServiceFactory :: getServiceInstance('CommonDescriptionService');
+
+/* Managing all possible inputs */
+isset($_POST['confirm']) ? define('POST_CONFIRM', $_POST['confirm']): define('POST_CONFIRM', '');
+isset($_POST['cancel']) ? define('POST_CANCEL', $_POST['cancel']): define('POST_CANCEL', '');
+isset($_POST['description']) ? define('POST_DESCRIPTION', $_POST['description']): define('POST_DESCRIPTION', '');
+isset($_POST['referrer']) ? define('POST_REFERRER', $_POST['referrer']): define('POST_REFERRER', '');
+
+
+/* Managing current logged user */
+$currentUser = $userservice->getCurrentObjectUser();
+
+/* Managing path info */
+list ($url, $tag) = explode('/', $_SERVER['PATH_INFO']);
+
+//permissions
+if(!$userservice->isLoggedOn() || (!$GLOBALS['enableCommonTagDescriptionEditedByAll'] && !$currentUser->isAdmin())) {
+ $tplVars['error'] = T_('Permission denied.');
+ $templateservice->loadTemplate('error.500.tpl', $tplVars);
+ exit();
+}
+
+$template = 'tagcommondescriptionedit.tpl';
+
+if (POST_CONFIRM) {
+
+ if ( strlen($tag)>0 &&
+ $cdservice->addTagDescription($tag, stripslashes(POST_DESCRIPTION), $currentUser->getId(), time())
+ ) {
+ $tplVars['msg'] = T_('Tag common description updated');
+ header('Location: '. POST_REFERRER);
+ } else {
+ $tplVars['error'] = T_('Failed to update the tag common description');
+ $template = 'error.500.tpl';
+ }
+} elseif (POST_CANCEL) {
+ header('Location: '. POST_REFERRER);
+} else {
+ $tplVars['subtitle'] = T_('Edit Tag Common Description') .': '. $tag;
+ $tplVars['formaction'] = $_SERVER['SCRIPT_NAME'] .'/'. $tag;
+ $tplVars['referrer'] = $_SERVER['HTTP_REFERER'];
+ $tplVars['tag'] = $tag;
+ $tplVars['description'] = $cdservice->getLastTagDescription($tag);
+}
+$templateservice->loadTemplate($template, $tplVars);
+?>
diff --git a/www/tagdelete.php b/www/tagdelete.php
new file mode 100644
index 0000000..61d2546
--- /dev/null
+++ b/www/tagdelete.php
@@ -0,0 +1,58 @@
+<?php
+/***************************************************************************
+Copyright (C) 2006 Scuttle project
+http://sourceforge.net/projects/scuttle/
+http://scuttle.org/
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+***************************************************************************/
+
+require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
+$b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService');
+
+
+/* Managing all possible inputs */
+isset($_POST['confirm']) ? define('POST_CONFIRM', $_POST['confirm']): define('POST_CONFIRM', '');
+isset($_POST['cancel']) ? define('POST_CANCEL', $_POST['cancel']): define('POST_CANCEL', '');
+isset($_POST['referrer']) ? define('POST_REFERRER', $_POST['referrer']): define('POST_REFERRER', '');
+
+/* Managing current logged user */
+$currentUser = $userservice->getCurrentObjectUser();
+
+/* Managing path info */
+list ($url, $tag) = explode('/', $_SERVER['PATH_INFO']);
+
+
+
+if (POST_CONFIRM) {
+ if ($b2tservice->deleteTag($currentUser->getId(), $tag)) {
+ $tplVars['msg'] = T_('Tag deleted');
+ header('Location: '. createURL('bookmarks', $currentUser->getUsername()));
+ } else {
+ $tplVars['error'] = T_('Failed to delete the tag');
+ $templateservice->loadTemplate('error.500.tpl', $tplVars);
+ exit();
+ }
+} elseif (POST_CANCEL) {
+ header('Location: '. POST_REFERRER);
+}
+
+$tplVars['subtitle'] = T_('Delete Tag') .': '. $tag;
+$tplVars['formaction'] = $_SERVER['SCRIPT_NAME'] .'/'. $tag;
+$tplVars['referrer'] = $_SERVER['HTTP_REFERER'];
+$templateservice->loadTemplate('tagdelete.tpl', $tplVars);
+?>
diff --git a/www/tagedit.php b/www/tagedit.php
new file mode 100644
index 0000000..e7b46a1
--- /dev/null
+++ b/www/tagedit.php
@@ -0,0 +1,68 @@
+<?php
+/***************************************************************************
+ Copyright (C) 2006 - 2007 Scuttle project
+ http://sourceforge.net/projects/scuttle/
+ http://scuttle.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ ***************************************************************************/
+
+require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
+$tagservice = & ServiceFactory :: getServiceInstance('TagService');
+
+/* Managing all possible inputs */
+isset($_POST['confirm']) ? define('POST_CONFIRM', $_POST['confirm']): define('POST_CONFIRM', '');
+isset($_POST['cancel']) ? define('POST_CANCEL', $_POST['cancel']): define('POST_CANCEL', '');
+isset($_POST['description']) ? define('POST_DESCRIPTION', $_POST['description']): define('POST_DESCRIPTION', '');
+isset($_POST['referrer']) ? define('POST_REFERRER', $_POST['referrer']): define('POST_REFERRER', '');
+
+/* Managing current logged user */
+$currentUser = $userservice->getCurrentObjectUser();
+
+/* Managing path info */
+list ($url, $tag) = explode('/', $_SERVER['PATH_INFO']);
+
+$template = 'tagedit.tpl';
+
+//permissions
+if(!$userservice->isLoggedOn()) {
+ $tplVars['error'] = T_('Permission denied.');
+ $templateservice->loadTemplate('error.500.tpl', $tplVars);
+ exit();
+}
+
+if (POST_CONFIRM) {
+ if ( strlen($tag)>0 &&
+ $tagservice->updateDescription($tag, $currentUser->getId(), stripslashes(POST_DESCRIPTION))
+ ) {
+ $tplVars['msg'] = T_('Tag description updated');
+ header('Location: '. POST_REFERRER);
+ } else {
+ $tplVars['error'] = T_('Failed to update the tag description');
+ $template = 'error.500.tpl';
+ }
+} elseif (POST_CANCEL) {
+ header('Location: '. POST_REFERRER);
+} else {
+ $tplVars['subtitle'] = T_('Edit Tag Description') .': '. $tag;
+ $tplVars['formaction'] = $_SERVER['SCRIPT_NAME'] .'/'. $tag;
+ $tplVars['referrer'] = $_SERVER['HTTP_REFERER'];
+ $tplVars['tag'] = $tag;
+ $tplVars['description'] = $tagservice->getDescription($tag, $currentUser->getId());
+}
+$templateservice->loadTemplate($template, $tplVars);
+?>
diff --git a/www/tagrename.php b/www/tagrename.php
new file mode 100644
index 0000000..bead5e7
--- /dev/null
+++ b/www/tagrename.php
@@ -0,0 +1,78 @@
+<?php
+/***************************************************************************
+ Copyright (C) 2006 - 2007 Scuttle project
+ http://sourceforge.net/projects/scuttle/
+ http://scuttle.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ ***************************************************************************/
+
+require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
+$b2tservice = & ServiceFactory :: getServiceInstance('Bookmark2TagService');
+$tagservice = & ServiceFactory :: getServiceInstance('TagService');
+$tag2tagservice = & ServiceFactory :: getServiceInstance('Tag2tagService');
+
+/* Managing all possible inputs */
+isset($_POST['confirm']) ? define('POST_CONFIRM', $_POST['confirm']): define('POST_CONFIRM', '');
+isset($_POST['cancel']) ? define('POST_CANCEL', $_POST['cancel']): define('POST_CANCEL', '');
+isset($_POST['old']) ? define('POST_OLD', $_POST['old']): define('POST_OLD', '');
+isset($_POST['new']) ? define('POST_NEW', $_POST['new']): define('POST_NEW', '');
+
+/* Managing current logged user */
+$currentUser = $userservice->getCurrentObjectUser();
+
+/* Managing path info */
+list ($url, $tag) = explode('/', $_SERVER['PATH_INFO']);
+//$tag = isset($_GET['query']) ? $_GET['query'] : NULL;
+$template = 'tagrename.tpl';
+
+if (POST_CONFIRM) {
+ if (trim(POST_OLD) != '') {
+ $old = trim(POST_OLD);
+ } else {
+ $old = NULL;
+ }
+
+ if (trim(POST_NEW) != '') {
+ $new = trim(POST_NEW);
+ } else {
+ $new = NULL;
+ }
+
+ if (
+ !is_null($old) &&
+ !is_null($new) &&
+ $tagservice->renameTag($currentUser->getId(), $old, $new) &&
+ $b2tservice->renameTag($currentUser->getId(), $old, $new) &&
+ $tag2tagservice->renameTag($currentUser->getId(), $old, $new)
+ ) {
+ $tplVars['msg'] = T_('Tag renamed');
+ header('Location: '. createURL('bookmarks', $currentUser->getUsername()));
+ } else {
+ $tplVars['error'] = T_('Failed to rename the tag');
+ $template = 'error.500.tpl';
+ }
+} elseif (POST_CANCEL) {
+ header('Location: '. createURL('bookmarks', $currentUser->getUsername() .'/'. $tags));
+} else {
+ $tplVars['subtitle'] = T_('Rename Tag') .': '. $tag;
+ $tplVars['formaction'] = $_SERVER['SCRIPT_NAME'] .'/'. $tag;
+ $tplVars['referrer'] = $_SERVER['HTTP_REFERER'];
+ $tplVars['old'] = $tag;
+}
+$templateservice->loadTemplate($template, $tplVars);
+?>
diff --git a/www/tags.php b/www/tags.php
new file mode 100644
index 0000000..376d9fe
--- /dev/null
+++ b/www/tags.php
@@ -0,0 +1,103 @@
+<?php
+/***************************************************************************
+ Copyright (C) 2004 - 2006 Scuttle project
+ http://sourceforge.net/projects/scuttle/
+ http://scuttle.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ ***************************************************************************/
+
+require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
+$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
+$cacheservice =& ServiceFactory::getServiceInstance('CacheService');
+
+/* Managing all possible inputs */
+isset($_GET['page']) ? define('GET_PAGE', $_GET['page']): define('GET_PAGE', 0);
+isset($_GET['sort']) ? define('GET_SORT', $_GET['sort']): define('GET_SORT', '');
+
+/* Managing current logged user */
+$currentUser = $userservice->getCurrentObjectUser();
+
+/* Managing path info */
+list($url, $cat) = explode('/', $_SERVER['PATH_INFO']);
+
+
+if (!$cat) {
+ header('Location: '. createURL('populartags'));
+ exit;
+}
+
+$titleTags = explode('+', filter($cat));
+$pagetitle = T_('Tags') .': ';
+for($i = 0; $i<count($titleTags);$i++) {
+ $pagetitle.= $titleTags[$i].'<a href="'.createUrl('tags', aggregateTags($titleTags, '+', $titleTags[$i])).'" title="'.T_('Remove the tag from the selection').'">*</a> + ';
+}
+$pagetitle = substr($pagetitle, 0, strlen($pagetitle) - strlen(' + '));
+
+
+//$cattitle = str_replace('+', ' + ', $cat);
+
+if ($usecache) {
+ // Generate hash for caching on
+ if ($userservice->isLoggedOn()) {
+ $hash = md5($_SERVER['REQUEST_URI'] . $currentUser->getId());
+ } else {
+ $hash = md5($_SERVER['REQUEST_URI']);
+ }
+
+ // Cache for 30 minutes
+ $cacheservice->Start($hash, 1800);
+}
+
+// Header variables
+$tplVars['pagetitle'] = T_('Tags') .': '. $cat;
+$tplVars['loadjs'] = true;
+$tplVars['rsschannels'] = array(
+array(filter($sitename .': '. $pagetitle), createURL('rss', 'all/'. filter($cat, 'url')).'?sort='.getSortOrder())
+);
+
+// Pagination
+$perpage = getPerPageCount($currentUser);
+if (intval(GET_PAGE) > 1) {
+ $page = GET_PAGE;
+ $start = ($page - 1) * $perpage;
+} else {
+ $page = 0;
+ $start = 0;
+}
+
+$tplVars['page'] = $page;
+$tplVars['start'] = $start;
+$tplVars['popCount'] = 25;
+$tplVars['currenttag'] = $cat;
+$tplVars['sidebar_blocks'] = array('linked', 'related', 'menu2');//array('linked', 'related', 'popular');
+$tplVars['subtitle'] = $pagetitle;
+$tplVars['bookmarkCount'] = $start + 1;
+$bookmarks =& $bookmarkservice->getBookmarks($start, $perpage, NULL, $cat, NULL, getSortOrder());
+$tplVars['total'] = $bookmarks['total'];
+$tplVars['bookmarks'] =& $bookmarks['bookmarks'];
+$tplVars['cat_url'] = createURL('bookmarks', '%1$s/%2$s');
+$tplVars['nav_url'] = createURL('tags', '%2$s%3$s');
+
+$templateservice->loadTemplate('bookmarks.tpl', $tplVars);
+
+if ($usecache) {
+ // Cache output if existing copy has expired
+ $cacheservice->End($hash);
+}
+
+?>
diff --git a/www/upgrade.php b/www/upgrade.php
new file mode 100644
index 0000000..a2fb606
--- /dev/null
+++ b/www/upgrade.php
@@ -0,0 +1,61 @@
+<?php
+/***************************************************************************
+Copyright (C) 2006 - 2007 Scuttle project
+http://sourceforge.net/projects/scuttle/
+http://scuttle.org/
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+***************************************************************************/
+
+
+/////////////////
+// WARNING!
+// Comment the two lines of code below to make work the script.
+// You have to put // at the beginning of lines to comment them.
+// BEFORE upgrading, don't forget to make a BACKUP of your database.
+// AFTER upgrading, don't forget to UN-COMMENT the lines back.
+/////////////////
+
+echo "Please edit the 'upgrade.php' file into SemanticScuttle/ to start upgrading";
+exit();
+
+/////////////////
+// This part below will be executed once you comment the two lines above
+/////////////////
+require_once('header.inc.php');
+$tagstatservice = & ServiceFactory :: getServiceInstance('TagStatService');
+?>
+
+<h1>Upgrade</h1>
+<h2>From Scuttle 0.7.2 to SemanticScuttle 0.87</h2>
+<ul>
+ <li>1/ Make a <b>backup</b> of your database</li>
+ <li>2/ Create the missing tables
+ <ul>
+ <li>Open "tables.sql" (into your SemanticScuttle directory) with a text editor</li>
+ <li>Copy to your database the last three tables : sc_tags2tags, sc_tagsstats, sc_commondescription</li>
+ </ul>
+ </li>
+ <li>3/ Complete the upgrade by clicking on the following link : <a href="upgrade.php?action=upgrade">upgrade</a></li>
+</ul>
+<?php
+if($_GET['action']=="upgrade") {
+ // Update the stats
+ $tagstatservice->updateAllStat();
+ echo "Upgrade script executed: OK!<br/><br/>";
+ echo "For security reason, don't forget to uncomment back the first lines into \"upgrade.php\"<br/><br/>";
+ echo 'In case of problem during upgrade, please use our <a href="http://sourceforge.net/tracker/?group_id=211356&atid=1017431">sourceforge page</a> to inform us. Thank you.';
+}
+?>
diff --git a/www/users.php b/www/users.php
new file mode 100644
index 0000000..e2689e6
--- /dev/null
+++ b/www/users.php
@@ -0,0 +1,62 @@
+<?php
+/***************************************************************************
+ Copyright (C) 2004 - 2006 Scuttle project
+ http://sourceforge.net/projects/scuttle/
+ http://scuttle.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ ***************************************************************************/
+
+require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
+$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
+$cacheservice =& ServiceFactory::getServiceInstance('CacheService');
+
+/* Managing current logged user */
+$currentUser = $userservice->getCurrentObjectUser();
+
+$pagetitle = T_('Users');
+
+if ($usecache) {
+ // Generate hash for caching on
+ if ($userservice->isLoggedOn()) {
+ $hash = md5($_SERVER['REQUEST_URI'] . $currentUser->getId());
+ } else {
+ $hash = md5($_SERVER['REQUEST_URI']);
+ }
+
+ // Cache for 30 minutes
+ $cacheservice->Start($hash, 1800);
+}
+
+// Header variables
+$tplVars['pagetitle'] = $pagetitle;
+$tplVars['loadjs'] = true;
+
+$tplVars['sidebar_blocks'] = array('recent', 'popular');
+$tplVars['subtitle'] = filter($pagetitle);
+
+$tplVars['users'] =& $userservice->getUsers();
+//$tplVars['cat_url'] = createURL('tags', '%2$s');
+//$tplVars['nav_url'] = createURL('tags', '%2$s%3$s');
+
+$templateservice->loadTemplate('users.tpl', $tplVars);
+
+if ($usecache) {
+ // Cache output if existing copy has expired
+ $cacheservice->End($hash);
+}
+?>
diff --git a/www/watch.php b/www/watch.php
new file mode 100644
index 0000000..01a6bcc
--- /dev/null
+++ b/www/watch.php
@@ -0,0 +1,61 @@
+<?php
+/***************************************************************************
+ Copyright (C) 2004 - 2006 Scuttle project
+ http://sourceforge.net/projects/scuttle/
+ http://scuttle.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ ***************************************************************************/
+
+require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
+//No specific services
+
+isset($_POST['contact']) ? define('POST_CONTACT', $_POST['contact']): define('POST_CONTACT', '');
+isset($_GET['contact']) ? define('GET_CONTACT', $_GET['contact']): define('GET_CONTACT', '');
+
+/* Managing path info */
+@list($url, $user) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL;
+
+if($user=='' && POST_CONTACT != '') {
+ $user = POST_CONTACT;
+} elseif($user=='' && GET_CONTACT != '') {
+ $user = GET_CONTACT;
+}
+
+if ($userservice->isLoggedOn() && $user) {
+ $pagetitle = '';
+
+ $userid = $userservice->getIdFromUser($user);
+
+ if($userid == NULL) {
+ $tplVars['error'] = sprintf(T_('User with username %s was not found'), $user);
+ $templateservice->loadTemplate('error.404.tpl', $tplVars);
+ exit();
+ }
+
+ $watched = $userservice->getWatchStatus($userid, $currentUser->getId());
+ $changed = $userservice->setWatchStatus($userid);
+
+ if ($watched) {
+ $tplVars['msg'] = T_('User removed from your watchlist');
+ } else {
+ $tplVars['msg'] = T_('User added to your watchlist');
+ }
+
+ header('Location: '. createURL('watchlist', $currentUser->getUsername()));
+}
+?>
diff --git a/www/watchlist.php b/www/watchlist.php
new file mode 100644
index 0000000..8780395
--- /dev/null
+++ b/www/watchlist.php
@@ -0,0 +1,128 @@
+<?php
+/***************************************************************************
+Copyright (C) 2004 - 2006 Scuttle project
+http://sourceforge.net/projects/scuttle/
+http://scuttle.org/
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+***************************************************************************/
+require_once('header.inc.php');
+
+/* Service creation: only useful services are created */
+$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
+$cacheservice =& ServiceFactory::getServiceInstance('CacheService');
+
+/* Managing all possible inputs */
+isset($_GET['page']) ? define('GET_PAGE', $_GET['page']): define('GET_PAGE', 0);
+isset($_GET['sort']) ? define('GET_SORT', $_GET['sort']): define('GET_SORT', '');
+
+/* Managing current logged user */
+$currentUser = $userservice->getCurrentObjectUser();
+
+/* Managing path info */
+@list($url, $user, $page) = isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : NULL;
+
+
+if ($usecache) {
+ // Generate hash for caching on
+ if ($userservice->isLoggedOn()) {
+ if ($currentUser->getUsername() != $user) {
+ $cachehash = md5($_SERVER['REQUEST_URI'] . $currentUser->getUsername());
+
+ // Cache for 5 minutes
+ $cacheservice->Start($cachehash);
+ }
+ } else {
+ // Cache for 30 minutes
+ $cachehash = md5($_SERVER['REQUEST_URI']);
+ $cacheservice->Start($cachehash, 1800);
+ }
+}
+
+if ($user) {
+ if (is_int($user)) {
+ $userid = intval($user);
+ } else {
+ $userinfo = $userservice->getObjectUserByUsername($user);
+ if ($userinfo == NULL ) {
+ // Throw a 404 error
+ $tplVars['error'] = sprintf(T_('User with username %s was not found'), $user);
+ $templateservice->loadTemplate('error.404.tpl', $tplVars);
+ exit();
+ } else {
+ $userid =& $userinfo->getId();
+ }
+ }
+}
+
+// Header variables
+$tplVars['loadjs'] = true;
+
+if ($user) {
+ $tplVars['user'] = $user;
+ $tplVars['userid'] = $userid;
+ $tplVars['userinfo'] =& $userinfo;
+
+ // Pagination
+ $perpage = getPerPageCount($currentUser);
+ if (intval(GET_PAGE) > 1) {
+ $page = GET_PAGE;
+ $start = ($page - 1) * $perpage;
+ } else {
+ $page = 0;
+ $start = 0;
+ }
+
+ // Set template vars
+ $tplVars['currenttag'] = '';
+ $tplVars['page'] = $page;
+ $tplVars['start'] = $start;
+ $tplVars['bookmarkCount'] = $start + 1;
+
+ $bookmarks =& $bookmarkservice->getBookmarks($start, $perpage, $userid, NULL, NULL, getSortOrder(), true);
+
+ $tplVars['sidebar_blocks'] = array('watchlist');
+ $tplVars['watched'] = true;
+ $tplVars['total'] = $bookmarks['total'];
+ $tplVars['bookmarks'] =& $bookmarks['bookmarks'];
+ $tplVars['cat_url'] = createURL('tags', '%2$s');
+ $tplVars['nav_url'] = createURL('watchlist', '%s/%s%s');
+
+ if ($userservice->isLoggedOn() && $user == $currentUser->getUsername()) {
+ $title = T_('My Watchlist');
+ } else {
+ $title = T_('Watchlist') .': '. $user;
+ }
+ $tplVars['pagetitle'] = $title;
+ $tplVars['subtitle'] = $title;
+ $tplVars['range'] = 'watchlist';
+ $tplVars['pageName'] = PAGE_WATCHLIST;
+
+ $tplVars['rsschannels'] = array(
+ array(filter($sitename .': '. $title), createURL('rss', 'watchlist/'. filter($user, 'url')))
+ );
+
+ $templateservice->loadTemplate('bookmarks.tpl', $tplVars);
+} else {
+ $tplVars['error'] = T_('Username was not specified');
+ $templateservice->loadTemplate('error.404.tpl', $tplVars);
+ exit();
+}
+
+if ($usecache) {
+ // Cache output if existing copy has expired
+ $cacheservice->End($hash);
+}
+?>
diff --git a/www/widgetUWA.php b/www/widgetUWA.php
new file mode 100644
index 0000000..25ec898
--- /dev/null
+++ b/www/widgetUWA.php
@@ -0,0 +1,234 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:widget="http://www.netvibes.com/ns/">
+<head>
+
+<title>SemanticScuttle</title>
+
+<meta name="author" content="Benjamin HKB (inspired by Florent Solt)" />
+<meta name="description" content="" />
+<meta name="keywords" content="semanticscuttle delicious del.icio.us" />
+
+<meta name="apiVersion" content="1.0" />
+<meta name="inline" content="true" />
+<meta name="autoRefresh" content="20" />
+<meta name="debugMode" content="false" />
+
+<link rel="icon" href="http://semanticscuttle.sourceforge.net/icon.png"/>
+
+<link rel="stylesheet" type="text/css" href="http://www.netvibes.com/themes/uwa/style.css" />
+<script type="text/javascript" src="http://www.netvibes.com/js/UWA/load.js.php?env=Standalone"></script>
+
+<widget:preferences>
+ <preference name="website" label="URL of the SemanticScuttle website" type="text" defaultValue="http://example.com" />
+ <preference name="websiteTitle" label="Website's title" type="text" defaultValue="Website Name" />
+ <preference name="account" label="User" type="text" defaultValue="" />
+ <preference name="tags" label="Tags (optionally separated by +)" type="text" defaultValue="tag1+tag2" />
+ <preference name="thumb" label="Show thumbnails" type="boolean" defaultValue="true" />
+ <preference name="limit" type="range" label="Number of items to display" defaultValue="20" step="1" min="1" max="50" />
+ <preference name="offset" type="hidden" defaultValue="0" />
+</widget:preferences>
+
+<style type="text/css">
+.container ul {
+ padding: 0px;
+}
+.container .clear {
+ clear: both;
+ height: 1px;
+ font-size: 1px;
+ line-height: 1px;
+}
+.container li {
+ background-image: none;
+ padding: 2px;
+ clear: both;
+ margin: 0px;
+}
+.container li a {
+ font-weight: bold;
+}
+.container li em {
+ display: block;
+}
+.container li img {
+ display: block;
+ float: left;
+ margin-right: 4px;
+ margin-bottom: 4px;
+}
+.container li img.thumb {
+ width: 60px;
+ height: 45px;
+ border: 1px solid #ccc;
+}
+.container li.cal {
+ padding-left: 20px;
+ background-image: url(http://www.netvibes.com/img/icons/time.png);
+ background-repeat: no-repeat;
+ background-position: left 1em;
+ line-height: 16px;
+ margin-bottom: 0.5em;
+ padding-top: 1em;
+ font-size: 1.3em;
+ border-bottom: 1px dotted #aaa;
+}
+
+</style>
+
+<script type="text/javascript">
+if (document.location && document.location.hostname == 'mymodules.local') {
+ UWA.proxies.ajax = 'ajaxProxy.php';
+}
+
+widget.months = {
+ 1:_('January'), '2':_('February'), 3:_('March'), 4:_('April'), 5:_('May'), 6:_('June'),
+ 7:_('July'), 8:_('August'), 9:_('September'), 10:_('October'), 11:_('November'), 12:_('December')
+}
+
+widget.onLoad = function() {
+ widget.onRefresh();
+}
+
+widget.onRefresh = function() {
+ widget.setBody( _("Loading ... (if loading is too long, check preferences: URL must be exact, user and tags must exist.)") );
+ var website = widget.getValue('website');
+ if(website.charAt(website.length-1) != '/') {
+ website = website +'/';
+ }
+
+ var websiteTitle = widget.getValue('websiteTitle');
+
+ var account = widget.getValue('account');
+ if(account == undefined || account == '') {
+ account = 'all';
+ }
+ var tags = widget.getValue('tags');
+ if(tags != undefined && tags != '') {
+ tags = '/' + tags;
+ var reg=new RegExp(" ", "g");
+ tags = tags.replace(reg, "%20");
+ }
+ if (website == undefined || website == 'http://example.com/') {
+ widget.setBody(_("Edit the widget please."));
+ } else {
+ //widget.setBody(website + 'rss/' + account + tags);
+ var title = '<a href="' + website + '">' + websiteTitle +'</a>';
+ title+= ' / <a href="http://sourceforge.net/projects/semanticscuttle/">'+ 'SemanticScuttle</a>';
+ widget.setTitle(title);
+ UWA.Data.getFeed(website + 'rss/' + account + tags, widget.onData);
+ }
+}
+
+widget.onData = function(data) {
+ widget.items = data.items;
+ //widget.log(data.items);
+ widget.display();
+}
+
+widget.display = function() {
+ // Main container
+ var container = widget.createElement('div');
+ container.className = 'container';
+
+ // Prev date
+ var prev_date = null;
+
+ // Items
+ var ul = widget.createElement('ul');
+ var limit = parseInt(widget.getValue('limit'));
+ var offset = parseInt(widget.getValue('offset'));
+ for (var i=offset; i<widget.items.length && i<limit+offset; i++) {
+
+ var date = new Date(widget.items[i].date)
+
+ // Cal
+ if (prev_date == null ||
+ date.getMonth() != prev_date.getMonth() ||
+ date.getDate() != prev_date.getDate() ||
+ date.getYear() != prev_date.getYear()) {
+ prev_date = date;
+ var cal = widget.createElement('li');
+ cal.className = 'cal';
+
+ var relative_to = new Date();
+ var delta = parseInt((relative_to.getTime() - date.getTime()) / 1000);
+ if (delta < 24*60*60) {
+ cal.appendText(_('Today'));
+ } else if (delta < 48*60*60) {
+ cal.appendText(_('Yesterday'));
+ } else {
+ cal.appendText(date.getDate() + ' ' + widget.months[date.getMonth() + 1])
+ }
+ ul.appendChild(cal);
+ }
+
+ // Li
+ var li = widget.createElement('li');
+ if (i%2 == 1) li.className = 'even';
+
+ if (widget.getValue('thumb') == 'true') {
+ // Img
+ var img = widget.createElement('img');
+ img.src = "http://open.thumbshots.org/image.pxf?url=" + widget.items[i].link.replace(/^(http:\/\/[^\/]+).*$/, '$1');
+ img.className = 'thumb';
+ li.appendChild(img);
+ } else {
+ var img = widget.createElement('img');
+ img.src = 'http://semanticscuttle.sourceforge.net/bookmark.gif'
+ li.appendChild(img);
+ }
+
+ // Title
+ var title = widget.createElement('a');
+ title.setContent(widget.items[i].title);
+ title.href = widget.items[i].link;
+ if(widget.items[i].content == '') {
+ widget.items[i].content = _("No description");
+ }
+ title.title= widget.items[i].content;
+ li.appendChild(title);
+
+ // // Tags
+ // console.log(widget.items[i]);
+ // var tagsText = widget.items[i].subject;
+ // if (tagsText != null) {
+ // tags = widget.createElement('em');
+ // tags.appendText(tagsText.nodeValue);
+ // li.appendChild(tags);
+ // }
+
+ // Clear
+ var clear = widget.createElement('div');
+ clear.className = 'clear';
+ li.appendChild(clear);
+
+ ul.appendChild(li);
+ }
+ container.appendChild(ul);
+
+ // Pager
+ var pager = widget.createElement('div');
+
+ var pager_ctrl = new UWA.Controls.Pager( {
+ module: this,
+ limit: widget.getValue('limit'),
+ offset: widget.getValue('offset'),
+ dataArray: widget.items
+ } );
+
+ pager_ctrl.onChange = function(newOffset) {
+ widget.setValue('offset', newOffset);
+ widget.display();
+ }
+ pager.setContent(pager_ctrl.getContent());
+ container.appendChild(pager);
+
+ widget.setBody(container);
+}
+
+</script>
+
+</head>
+<body>
+</body>
+</html>