From 29422fa55379aa61a61019b832c83dab6d450264 Mon Sep 17 00:00:00 2001 From: cweiske Date: Sat, 3 Oct 2009 14:00:33 +0000 Subject: move files to new locations git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@386 b3834d28-1941-0410-a4f8-b48e95affb8f --- www/about.php | 27 ++ www/admin.php | 94 ++++++ www/ajax/getadminlinkedtags.php | 64 ++++ www/ajax/getadmintags.php | 44 +++ www/ajax/getcontacttags.php | 44 +++ www/ajax/getlinkedtags.php | 64 ++++ www/ajax/gettags.php | 44 +++ www/ajaxDelete.php | 48 +++ www/ajaxGetTitle.php | 73 +++++ www/ajaxIsAvailable.php | 44 +++ www/alltags.php | 87 ++++++ www/api/export_csv.php | 47 +++ www/api/export_gcs.php | 66 ++++ www/api/export_html.php | 54 ++++ www/api/export_sioc.php | 90 ++++++ www/api/httpauth.inc.php | 33 ++ www/api/opensearch.php | 18 ++ www/api/posts_add.php | 83 +++++ www/api/posts_all.php | 48 +++ www/api/posts_dates.php | 40 +++ www/api/posts_delete.php | 34 ++ www/api/posts_get.php | 61 ++++ www/api/posts_public.php | 48 +++ www/api/posts_recent.php | 62 ++++ www/api/posts_update.php | 25 ++ www/api/tags_get.php | 26 ++ www/api/tags_rename.php | 37 +++ www/bookmarkcommondescriptionedit.php | 78 +++++ www/bookmarks.php | 292 +++++++++++++++++ www/edit.php | 121 +++++++ www/gsearch/context.php | 27 ++ www/gsearch/index.php | 45 +++ www/history.php | 93 ++++++ www/icon.png | Bin 0 -> 771 bytes www/images/b_edit.png | Bin 0 -> 451 bytes www/images/bg_admin.png | Bin 0 -> 1212 bytes www/images/bg_bar.png | Bin 0 -> 873 bytes www/images/bg_header.png | Bin 0 -> 684 bytes www/images/bg_sidebar.png | Bin 0 -> 726 bytes www/images/loading.gif | Bin 0 -> 1582 bytes www/images/logo.png | Bin 0 -> 2973 bytes www/images/logo_24.gif | Bin 0 -> 1530 bytes www/images/rss.gif | Bin 0 -> 401 bytes www/import.php | 116 +++++++ www/importNetscape.php | 126 ++++++++ www/importStructure.php | 76 +++++ www/index.php | 99 ++++++ www/js/MultiComboBox.js | 72 +++++ www/jsScuttle.php | 148 +++++++++ www/login.php | 62 ++++ www/password.php | 78 +++++ www/player/error.swf | Bin 0 -> 90 bytes www/player/license.txt | 10 + www/player/load.swf | Bin 0 -> 311 bytes www/player/musicplayer_f6.swf | Bin 0 -> 6463 bytes www/player/play.swf | Bin 0 -> 73 bytes www/player/stop.swf | Bin 0 -> 77 bytes www/populartags.php | 84 +++++ www/profile.php | 129 ++++++++ www/register.php | 80 +++++ www/rss.php | 121 +++++++ www/scuttle.css | 571 ++++++++++++++++++++++++++++++++++ www/search.php | 136 ++++++++ www/tag2tagadd.php | 69 ++++ www/tag2tagdelete.php | 85 +++++ www/tag2tagedit.php | 60 ++++ www/tagcommondescriptionedit.php | 71 +++++ www/tagdelete.php | 58 ++++ www/tagedit.php | 68 ++++ www/tagrename.php | 78 +++++ www/tags.php | 103 ++++++ www/upgrade.php | 61 ++++ www/users.php | 62 ++++ www/watch.php | 61 ++++ www/watchlist.php | 128 ++++++++ www/widgetUWA.php | 234 ++++++++++++++ 76 files changed, 5107 insertions(+) create mode 100644 www/about.php create mode 100644 www/admin.php create mode 100644 www/ajax/getadminlinkedtags.php create mode 100644 www/ajax/getadmintags.php create mode 100644 www/ajax/getcontacttags.php create mode 100644 www/ajax/getlinkedtags.php create mode 100644 www/ajax/gettags.php create mode 100644 www/ajaxDelete.php create mode 100644 www/ajaxGetTitle.php create mode 100644 www/ajaxIsAvailable.php create mode 100644 www/alltags.php create mode 100644 www/api/export_csv.php create mode 100644 www/api/export_gcs.php create mode 100644 www/api/export_html.php create mode 100644 www/api/export_sioc.php create mode 100644 www/api/httpauth.inc.php create mode 100644 www/api/opensearch.php create mode 100644 www/api/posts_add.php create mode 100644 www/api/posts_all.php create mode 100644 www/api/posts_dates.php create mode 100644 www/api/posts_delete.php create mode 100644 www/api/posts_get.php create mode 100644 www/api/posts_public.php create mode 100644 www/api/posts_recent.php create mode 100644 www/api/posts_update.php create mode 100644 www/api/tags_get.php create mode 100644 www/api/tags_rename.php create mode 100644 www/bookmarkcommondescriptionedit.php create mode 100644 www/bookmarks.php create mode 100644 www/edit.php create mode 100644 www/gsearch/context.php create mode 100644 www/gsearch/index.php create mode 100644 www/history.php create mode 100644 www/icon.png create mode 100644 www/images/b_edit.png create mode 100644 www/images/bg_admin.png create mode 100644 www/images/bg_bar.png create mode 100644 www/images/bg_header.png create mode 100644 www/images/bg_sidebar.png create mode 100644 www/images/loading.gif create mode 100644 www/images/logo.png create mode 100644 www/images/logo_24.gif create mode 100644 www/images/rss.gif create mode 100644 www/import.php create mode 100644 www/importNetscape.php create mode 100644 www/importStructure.php create mode 100644 www/index.php create mode 100644 www/js/MultiComboBox.js create mode 100644 www/jsScuttle.php create mode 100644 www/login.php create mode 100644 www/password.php create mode 100644 www/player/error.swf create mode 100644 www/player/license.txt create mode 100644 www/player/load.swf create mode 100644 www/player/musicplayer_f6.swf create mode 100644 www/player/play.swf create mode 100644 www/player/stop.swf create mode 100644 www/populartags.php create mode 100644 www/profile.php create mode 100644 www/register.php create mode 100644 www/rss.php create mode 100644 www/scuttle.css create mode 100644 www/search.php create mode 100644 www/tag2tagadd.php create mode 100644 www/tag2tagdelete.php create mode 100644 www/tag2tagedit.php create mode 100644 www/tagcommondescriptionedit.php create mode 100644 www/tagdelete.php create mode 100644 www/tagedit.php create mode 100644 www/tagrename.php create mode 100644 www/tags.php create mode 100644 www/upgrade.php create mode 100644 www/users.php create mode 100644 www/watch.php create mode 100644 www/watchlist.php create mode 100644 www/widgetUWA.php (limited to 'www') 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 @@ +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 @@ +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'] .')
'; + } + } + 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 @@ +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: [ + +] } 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 @@ + + +{identifier:"tag", +items: [ +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 @@ + + +{identifier:"tag", +items: [ +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 @@ +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: [ + +] } 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 @@ + + +{identifier:"tag", +items: [ +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 @@ +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'); +} + +?> + + deleteConfirmed + + \ 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 @@ +(.*)<\/title>/si', $html, $matches); + $title = $matches[1][0]; + + // Get encoding from charset attribute + preg_match_all('//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 ''; +?> + + +getTitle + + + + + 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 @@ +isReserved(GET_USERNAME)) { + $result = 'false'; +} else { + $result = $userservice->getUserByUsername(GET_USERNAME) ? 'false' : 'true'; +} +?> + + isAvailable + + \ 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 @@ +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 @@ +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 @@ +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 ''."\n"; + echo ' '."\n"; + foreach($bookmarks['bookmarks'] as $row) { + //if(substr($row['bAddress'], 0, 7) == "http://") { + if(checkUrl($row['bAddress'], false)) { + echo ' '."\n"; + echo ' '."\n"; + } + } + echo ' '."\n"; + echo ''."\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 @@ +getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag, NULL, getSortOrder()); + + +// Set up the XML file and output all the posts. +echo ''."\r\n"; +echo ''; +echo ''."\r\n"; +echo 'Bookmarks'."\r\n"; +echo '

Bookmarks for '. htmlspecialchars($currentUser->getUsername()) .''. (is_null($tag) ? '' : ' tag="'. htmlspecialchars($tag) .'"') ." from " . $sitename ."

\r\n"; +echo '

'."\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

" . filter($row['bTitle'], 'xml') ."\r\n"; +} + + +echo '

'; +?> 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 @@ + +"; ?> + + + + + + + +?> + +getObjectUsers(); + +$usersArray = array(); // useful for bookmarks display +foreach($users as $user) { + $usersArray[$user->getId()] = $user->getUserName(); +} +?> + + + + getUserName() ?> + + + + + + Authors at PlanetRDF.com + + +*/ +?> + +getBookmarks(0, NULL, NULL, NULL); +?> + + + + + + + + + + + + + + + + + + + + + + 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 @@ +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 @@ + + + + + + + UTF-8 + + Jan Seifert "jan.seifert@uid.com" + semanticscuttle bookmark web + 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= + + + 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 @@ + 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 '\r\n"; +echo ''; +?> \ 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 @@ +getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag); + +// Set up the XML file and output all the posts. +header('Content-Type: text/xml'); +echo '\r\n"; +echo '\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\r\n"; +} + +echo ''; +?> \ 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 @@ +getBookmarks(0, NULL, $userservice->getCurrentUserId(), $tag); + +// Set up the XML file and output all the tags. +header('Content-Type: text/xml'); +echo '\r\n"; +echo '\r\n"; + +$lastdate = NULL; +foreach($bookmarks['bookmarks'] as $row) { + $thisdate = gmdate('Y-m-d', strtotime($row['bDatetime'])); + if ($thisdate != $lastdate && $lastdate != NULL) { + echo "\t\r\n"; + $count = 1; + } else { + $count = $count + 1; + } + $lastdate = $thisdate; +} + +echo ""; +?> \ 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 @@ +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 '\r\n"; +echo ''; +?> \ 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 @@ +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 '\r\n"; +echo '\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\r\n"; +} + +echo ''; +?> \ 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 @@ +getBookmarks(0, NULL, NULL, $tag); + +// Set up the XML file and output all the posts. +header('Content-Type: text/xml'); +echo '\r\n"; +echo '\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\r\n"; +} + +echo ''; +?> 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 @@ + $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 '\r\n"; +echo '\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\r\n"; +} + +echo ''; +?> \ 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 @@ +getBookmarks(0, 1, $userservice->getCurrentUserId()); + + +// Set up the XML file and output all the tags. +header('Content-Type: text/xml'); +echo '\r\n"; +foreach($bookmarks['bookmarks'] as $row) { + echo ''; +} +?> \ 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 @@ +getTags($userservice->getCurrentUserId()); + +// Set up the XML file and output all the tags. +header('Content-Type: text/xml'); +echo '\r\n"; +echo "\r\n"; +foreach($tags as $row) { + echo "\t\r\n"; +} +echo ""; +?> 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 @@ +) 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 '\r\n"; +echo ''. ($renamed ? 'done' : 'something went wrong') .''; +?> 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 @@ +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 @@ +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* + '; + } + $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'] = ''; + } else { + $tplVars['msg'] = T_('Bookmark saved') . ' '.T_('(Come back to previous page.)').''; + // 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 @@ +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 != '') ? '' : T_('Bookmark saved'); + $tplVars['msg'] = ''; + } 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'] = ''; + } 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 echo $GLOBALS['sitename'] ?> + + + + + + + + + + + + + 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 echo $GLOBALS['sitename'] ?> + +

+
+ + +
+ + + +
+ + +Based on Google Custom Search over this list of websites from . +
+
+... + + +isLoggedOn() && $currentUser->isAdmin()){ + echo '

'; + echo T_('Admin tips: '); + echo T_('To refresh manually Google Custom Search Engine, goes to: '); + echo 'http://www.google.com/coop/cse/cref
'; + echo T_('If no result appears, check that all the urls are valid in the admin section.'); + echo '

'; + +} +?> + +
+ + + + 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 @@ +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 Binary files /dev/null and b/www/icon.png differ diff --git a/www/images/b_edit.png b/www/images/b_edit.png new file mode 100644 index 0000000..05711a0 Binary files /dev/null and b/www/images/b_edit.png differ diff --git a/www/images/bg_admin.png b/www/images/bg_admin.png new file mode 100644 index 0000000..c707779 Binary files /dev/null and b/www/images/bg_admin.png differ diff --git a/www/images/bg_bar.png b/www/images/bg_bar.png new file mode 100644 index 0000000..7152ba1 Binary files /dev/null and b/www/images/bg_bar.png differ diff --git a/www/images/bg_header.png b/www/images/bg_header.png new file mode 100644 index 0000000..6fa4161 Binary files /dev/null and b/www/images/bg_header.png differ diff --git a/www/images/bg_sidebar.png b/www/images/bg_sidebar.png new file mode 100644 index 0000000..0edb153 Binary files /dev/null and b/www/images/bg_sidebar.png differ diff --git a/www/images/loading.gif b/www/images/loading.gif new file mode 100644 index 0000000..859126e Binary files /dev/null and b/www/images/loading.gif differ diff --git a/www/images/logo.png b/www/images/logo.png new file mode 100644 index 0000000..4afe565 Binary files /dev/null and b/www/images/logo.png differ diff --git a/www/images/logo_24.gif b/www/images/logo_24.gif new file mode 100644 index 0000000..d5af64d Binary files /dev/null and b/www/images/logo_24.gif differ diff --git a/www/images/rss.gif b/www/images/rss.gif new file mode 100644 index 0000000..094ba10 Binary files /dev/null and b/www/images/rss.gif 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 @@ +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 @@ +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('/([^<]*)/si', $html, $matches); + preg_match_all('/([^<]*?)<\/a>.*?(
([^<]*)|
)/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 "
"; + // 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 = ''; + var code = code + ''; + var code = 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; $i* + '; +} +$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 @@ + + +

Upgrade

+

From Scuttle 0.7.2 to SemanticScuttle 0.87

+
    +
  • 1/ Make a backup of your database
  • +
  • 2/ Create the missing tables +
      +
    • Open "tables.sql" (into your SemanticScuttle directory) with a text editor
    • +
    • Copy to your database the last three tables : sc_tags2tags, sc_tagsstats, sc_commondescription
    • +
    +
  • +
  • 3/ Complete the upgrade by clicking on the following link : upgrade
  • +
+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 @@ + + + + +SemanticScuttle + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3-54-g00ecf