'."\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
';
+?>
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 @@
+
+"; ?>
+ ';
+ echo T_('Admin tips: ');
+ echo T_('To refresh manually Google Custom Search Engine, goes to: ');
+ echo 'http://www.google.com/coop/cse/cref
+
+
+
+
+
+Based on Google Custom Search over this list of websites from .
+
+
+...
+
+
+isLoggedOn() && $currentUser->isAdmin()){
+ echo '
';
+ echo T_('If no result appears, check that all the urls are valid in the admin section.');
+ echo '
";
+ // echo $links[$i]."
";
+
+ 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('"', '"', 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 @@
+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 @@
+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 @@
+
+
+function _playerAdd(anchor) {
+ var url = anchor.href;
+ var code = '';
+ 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 = " - ";
+ 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('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(images/loading.gif)';
+ if (response != '') {
+ usernameField.style.backgroundImage = 'none';
+ if (response == 'true') {
+ availability.className = 'available';
+ availability.innerHTML = '';
+ } else {
+ availability.className = 'not-available';
+ availability.innerHTML = '';
+ }
+ } else {
+ loadXMLDoc('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(images/loading.gif)';
+ if (response != null) {
+ title.style.backgroundImage = 'none';
+ title.value = response;
+ } else if (input.indexOf('http') > -1) {
+ loadXMLDoc('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 @@
+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 @@
+e-mail 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 e-mail 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
Binary files /dev/null and b/www/player/error.swf 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
Binary files /dev/null and b/www/player/load.swf differ
diff --git a/www/player/musicplayer_f6.swf b/www/player/musicplayer_f6.swf
new file mode 100644
index 0000000..2eb5d57
Binary files /dev/null and b/www/player/musicplayer_f6.swf differ
diff --git a/www/player/play.swf b/www/player/play.swf
new file mode 100644
index 0000000..95415a6
Binary files /dev/null and b/www/player/play.swf differ
diff --git a/www/player/stop.swf b/www/player/stop.swf
new file mode 100644
index 0000000..e66556d
Binary files /dev/null and b/www/player/stop.swf 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 @@
+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 @@
+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 @@
+must 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 @@
+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 @@
+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 ').'Google Custom Search page.';
+ }
+ $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 @@
+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 @@
+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 @@
+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 @@
+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 @@
+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 @@
+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 @@
+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 @@
+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; $iUpgrade
+From Scuttle 0.7.2 to SemanticScuttle 0.87
+
+
+updateAllStat();
+ echo "Upgrade script executed: OK!
+
+
";
+ echo "For security reason, don't forget to uncomment back the first lines into \"upgrade.php\"
";
+ echo 'In case of problem during upgrade, please use our sourceforge page 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 @@
+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 @@
+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 @@
+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 @@
+
+
+
+
+