From 27e154e5fc3dcfb234ad0784ee72c766fe728b64 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Fri, 18 Sep 2015 20:49:29 +0200 Subject: mention phpmyadmin --- doc/INSTALL.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/INSTALL.txt b/doc/INSTALL.txt index c911740..4aadd16 100644 --- a/doc/INSTALL.txt +++ b/doc/INSTALL.txt @@ -29,6 +29,8 @@ then this instructions are for you. $ psql mydatabasename myusername < data/tables-postgresql.sql + You can also use a web interface like phpMyAdmin to import the file. + 3. Copy ``data/config.php.dist`` to ``data/config.php`` and modify it as necessary. See configuration_ for more information. 4. Make the cache directory writable by your web server. -- cgit v1.2.3 From 833537692e62db2a7dea1c9eb74b79c5311fc39b Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 9 May 2016 21:39:18 +0200 Subject: Move URL title method to dedicated class --- src/SemanticScuttle/UrlHelper.php | 65 +++++++++++++++++++++++++++++++++++++++ www/ajaxGetTitle.php | 50 +++--------------------------- 2 files changed, 69 insertions(+), 46 deletions(-) create mode 100644 src/SemanticScuttle/UrlHelper.php diff --git a/src/SemanticScuttle/UrlHelper.php b/src/SemanticScuttle/UrlHelper.php new file mode 100644 index 0000000..5417b9b --- /dev/null +++ b/src/SemanticScuttle/UrlHelper.php @@ -0,0 +1,65 @@ + + * @license GPL http://www.gnu.org/licenses/gpl.html + * @link http://sourceforge.net/projects/semanticscuttle + */ + +/** + * Work with URLs + * + * @category Bookmarking + * @package SemanticScuttle + * @author Christian Weiske + * @license GPL http://www.gnu.org/licenses/gpl.html + * @link http://sourceforge.net/projects/semanticscuttle + */ +class SemanticScuttle_UrlHelper +{ + function getTitle($url) + { + $fd = @fopen($url, 'r'); + $title = ''; + if ($fd) { + $html = fread($fd, 1750); + fclose($fd); + + // Get title from title tag + preg_match_all('/]*>(.*)<\/title>/si', $html, $matches); + $title = $matches[1][0]; + + $encoding = 'utf-8'; + // Get encoding from charset attribute + preg_match_all('//i', $html, $matches); + if (isset($matches[1][0])) { + $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); + } + + $title = trim($title); + } + + if (utf8_strlen($title) > 0) { + $title = html_entity_decode($title, ENT_QUOTES, 'UTF-8'); + return $title; + } else { + // No title, so return filename + $uriparts = explode('/', $url); + $filename = end($uriparts); + unset($uriparts); + + return $filename; + } + } +} +?> diff --git a/www/ajaxGetTitle.php b/www/ajaxGetTitle.php index e1fbe30..b95e29b 100644 --- a/www/ajaxGetTitle.php +++ b/www/ajaxGetTitle.php @@ -27,53 +27,11 @@ require_once 'www-header.php'; /* Managing all possible inputs */ isset($_GET['url']) ? define('GET_URL', $_GET['url']): define('GET_URL', ''); +$urlhelper = new SemanticScuttle_UrlHelper(); -function getTitle($url) { - $fd = @fopen($url, 'r'); - if ($fd) { - $html = fread($fd, 1750); - fclose($fd); - - // Get title from title tag - preg_match_all('/(.*)<\/title>/si', $html, $matches); - $title = $matches[1][0]; - - $encoding = 'utf-8'; - // Get encoding from charset attribute - preg_match_all('/<meta.*charset=([^;"]*)">/i', $html, $matches); - if (isset($matches[1][0])) { - $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); - } - - $title = trim($title); - - if (utf8_strlen($title) > 0) { - $title = html_entity_decode($title, ENT_QUOTES, 'UTF-8'); - return $title; - } else { - // No title, so return filename - $uriparts = explode('/', $url); - $filename = end($uriparts); - unset($uriparts); - - return $filename; - } - } else { - return false; - } -} -echo '<?xml version="1.0" encoding="utf-8"?>'; +echo '<?xml version="1.0" encoding="utf-8"?>' . "\n"; ?> <response> -<method> -getTitle -</method> -<result> -<?php echo getTitle(GET_URL); ?> -</result> + <method>getTitle</method> + <result><?php echo htmlspecialchars($urlhelper->getTitle(GET_URL)); ?></result> </response> -- cgit v1.2.3 From e636523aac630d73cda415cf551d0be570ce10d6 Mon Sep 17 00:00:00 2001 From: Christian Weiske <cweiske@cweiske.de> Date: Mon, 9 May 2016 21:41:32 +0200 Subject: script to use with errbot's exec plugin --- data/config.default.php | 6 ++ scripts/bookmark-bot.php | 125 +++++++++++++++++++++++++++++++++++++++++ src/SemanticScuttle/header.php | 1 + 3 files changed, 132 insertions(+) create mode 100755 scripts/bookmark-bot.php diff --git a/data/config.default.php b/data/config.default.php index 5e560a7..8af04ba 100644 --- a/data/config.default.php +++ b/data/config.default.php @@ -778,4 +778,10 @@ $unittestUrl = null; */ $allowUnittestMode = false; +/** + * bookmark-bot email address mapping + * Input address as key, user email as target + */ +$botMailMap = array(); + ?> diff --git a/scripts/bookmark-bot.php b/scripts/bookmark-bot.php new file mode 100755 index 0000000..126f39c --- /dev/null +++ b/scripts/bookmark-bot.php @@ -0,0 +1,125 @@ +#!/usr/bin/env php +<?php +/** + * CLI tool to add bookmarks to SemanticScuttle. + * Intended as end point for a chat bot, e.g. "errbot-exec". + * + * Parameters: + * 1. Message with bookmark url and tags + * 2. E-Mail address of user + * + * You may map chat users to semanticscuttle email addresses + * with the $botMailMap config variable + * + * @author Christian Weiske <cweiske@cweiske.de> + * @link https://github.com/cweiske/errbot-exec + */ +require_once dirname(__FILE__) . '/../src/SemanticScuttle/header-standalone.php'; + +if ($argc < 3) { + err('No message and user', 1); +} +$msg = $argv[1]; +$email = $argv[2]; + +if (preg_match('#(.+@.+)/.*#', $email, $matches)) { + //xmpp user name with resource: user@example.org/client + $email = $matches[1]; +} +if (isset($botMailMap[$email])) { + $email = $botMailMap[$email]; +} + +function err($msg, $code) +{ + echo $msg . "\n"; + exit($code); +} + +function getUserId($email) +{ + $users = SemanticScuttle_Service_Factory::get('User'); + if (!$users->isValidEmail($email)) { + err('Invalid e-mail address: ' . $email, 2); + } + $db = SemanticScuttle_Service_Factory::getDb(); + $res = $db->sql_query( + 'SELECT uId FROM '. $users->getTableName() + . ' WHERE email = "' . $db->sql_escape($email) . '"' + ); + $row = $db->sql_fetchrow($res); + if (!is_array($row)) { + err('User not found: ' . $email, 3); + } + return intval($row['uId']); +} + +function splitMsg($msg) +{ + $bmUrl = $msg; + $rest = ''; + if (strpos($msg, ' ') !== false) { + list($bmUrl, $rest) = explode(' ', $msg, 2); + } + $parts = parse_url($bmUrl); + if (!isset($parts['scheme'])) { + err('Scheme missing in URL', 2); + } + if (!SemanticScuttle_Model_Bookmark::isValidUrl($bmUrl)) { + err('Invalid bookmark URL', 2); + } + + $bmTags = array(); + $bmDesc = ''; + $rest = trim($rest); + if (strlen($rest) && $rest{0} == '#') { + //tags begin with '#' + preg_match_all('/#([a-zA-Z0-9]+)/', $rest, $matches); + $bmTags = $matches[1]; + foreach ($matches[0] as $tag) { + if (substr($rest, 0, strlen($tag)) == $tag) { + $rest = trim(substr($rest, strlen($tag))); + } + } + $bmDesc = $rest; + } else { + //use rest as tags + $bmTags = explode(' ', $rest); + $bmTags = array_map('trim', $bmTags); + } + + return array($bmUrl, $bmTags, $bmDesc); +} + +$userId = getUserId($email); +list($bmUrl, $bmTags, $bmDesc) = splitMsg($msg); + +$bookmarks = SemanticScuttle_Service_Factory::get('Bookmark'); +if ($bookmarks->bookmarkExists($bmUrl)) { + echo "URL already bookmarked.\n"; + exit(0); +} + +$urlhelper = new SemanticScuttle_UrlHelper(); +$bmTitle = $urlhelper->getTitle($bmUrl); + +$id = $bookmarks->addBookmark( + $bmUrl, + $bmTitle, + $bmDesc, + null, + SemanticScuttle_Model_Bookmark::SPUBLIC, + $bmTags, + null, + null, + true, + false, + $userId +); +if ($id === false) { + err('Error adding bookmark', 10); +} else { + echo "Bookmark created.\n"; + exit(0); +} +?> diff --git a/src/SemanticScuttle/header.php b/src/SemanticScuttle/header.php index 1f2f12c..562ae43 100644 --- a/src/SemanticScuttle/header.php +++ b/src/SemanticScuttle/header.php @@ -105,6 +105,7 @@ require_once 'SemanticScuttle/functions.php'; require_once 'SemanticScuttle/Model/Bookmark.php'; require_once 'SemanticScuttle/Model/UserArray.php'; require_once 'SemanticScuttle/Model/User/SslClientCert.php'; +require_once 'SemanticScuttle/UrlHelper.php'; if (count($GLOBALS['serviceoverrides']) > 0 && !defined('UNIT_TEST_MODE') -- cgit v1.2.3 From ea04385bc16de6b7b65aab75c5c33cfe2d71ea84 Mon Sep 17 00:00:00 2001 From: querwurzelt <> Date: Sun, 20 Jan 2019 22:19:33 +0100 Subject: PHP 7.3 compat, bug fixes --- README.md | 16 ++++++++++++++ cache/.gitignore | 1 + cache/.htaccess | 3 +-- data/config.default.php | 6 ++--- data/config.php.dist | 6 ++--- data/schema/2.sql | 2 +- data/tables.sql | 7 ++++-- data/templates/default/dynamictags.inc.php | 2 +- data/templates/default/sidebar.block.popular.php | 2 +- data/templates/default/sidebar.block.recent.php | 2 +- data/templates/default/tags.tpl.php | 2 +- res/docs/header.tpl.html | 8 ------- res/docs/style.css | 28 ------------------------ src/SemanticScuttle/Service/Bookmark.php | 6 ++--- src/SemanticScuttle/Service/Bookmark2Tag.php | 10 ++++++--- www/.htaccess | 2 +- 16 files changed, 45 insertions(+), 58 deletions(-) create mode 100644 README.md create mode 100644 cache/.gitignore delete mode 100644 res/docs/header.tpl.html delete mode 100644 res/docs/style.css diff --git a/README.md b/README.md new file mode 100644 index 0000000..8d5f588 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# SemanticScuttle + +SemanticScuttle is a social bookmarking tool experimenting with new features like structured tags and collaborative descriptions of tags. Originally a fork of Scuttle, it has overtaken its ancestor in stability, features and usability. + +## Features + * LDAP/Active Directory authentication + * RSS feed support: global feed, user feeds, per-tag feeds, private feeds + * Public and private bookmarks + * Delicious and Browser bookmark import + * Theming support + * Firefox plugin + +## Origin + + * https://sourceforge.net/projects/semanticscuttle/ + * https://github.com/cweiske/SemanticScuttle diff --git a/cache/.gitignore b/cache/.gitignore new file mode 100644 index 0000000..f05fcdc --- /dev/null +++ b/cache/.gitignore @@ -0,0 +1 @@ +*.cache \ No newline at end of file diff --git a/cache/.htaccess b/cache/.htaccess index baa56e5..b66e808 100644 --- a/cache/.htaccess +++ b/cache/.htaccess @@ -1,2 +1 @@ -order allow,deny -deny from all \ No newline at end of file +Require all denied diff --git a/data/config.default.php b/data/config.default.php index 8af04ba..bb9eddb 100644 --- a/data/config.default.php +++ b/data/config.default.php @@ -115,7 +115,7 @@ $usecache = false; * * @var string */ -$dir_cache = dirname(__FILE__) . '/cache/'; +$dir_cache = dirname(__DIR__, 1) . '/cache'; /** * Use clean urls without .php filenames. @@ -149,14 +149,14 @@ $debugMode = false; * * @var string */ -$dbtype = 'mysql4'; +$dbtype = 'mysqli'; /** * Database hostname/IP * * @var string */ -$dbhost = '127.0.0.1'; +$dbhost = 'localhost'; /** * Database port. diff --git a/data/config.php.dist b/data/config.php.dist index 5f49857..61eb7af 100644 --- a/data/config.php.dist +++ b/data/config.php.dist @@ -46,7 +46,7 @@ $cleanurls = false; * * @var boolean */ -$debugMode = true; +$debugMode = false; /*************************************************** @@ -62,7 +62,7 @@ $debugMode = true; * * @var string */ -$dbtype = 'mysql4'; +$dbtype = 'mysqli'; /** * Database username * @@ -89,7 +89,7 @@ $dbname = 'scuttle'; * * @var string */ -$dbhost = '127.0.0.1'; +$dbhost = 'localhost'; /*************************************************** diff --git a/data/schema/2.sql b/data/schema/2.sql index 6c3bfaf..171e011 100644 --- a/data/schema/2.sql +++ b/data/schema/2.sql @@ -1,4 +1,4 @@ -ALTER TABLE `sc_bookmarks` CHANGE `bDescription` `bDescription` VARCHAR( 1500 ) +ALTER TABLE `sc_bookmarks` CHANGE `bDescription` `bDescription` VARCHAR( 1500 ); CREATE TABLE `sc_tagscache` ( `tcId` int(11) NOT NULL auto_increment, `tag1` varchar(100) NOT NULL default '', diff --git a/data/tables.sql b/data/tables.sql index 68d5ba9..de1bb8d 100644 --- a/data/tables.sql +++ b/data/tables.sql @@ -5,6 +5,9 @@ -- Table structure for table `sc_bookmarks` -- +# to avoid STRICT_TRANS_TABLES mode +SET sql_mode = ''; + CREATE TABLE `sc_bookmarks` ( `bId` int(11) NOT NULL auto_increment, `uId` int(11) NOT NULL default '0', @@ -17,8 +20,8 @@ CREATE TABLE `sc_bookmarks` ( `bDescription` text default NULL, `bPrivateNote` text default NULL, `bHash` varchar(32) NOT NULL default '', - `bVotes` int(11) NOT NULL, - `bVoting` int(11) NOT NULL, + `bVotes` int(11) NOT NULL default '0', + `bVoting` int(11) NOT NULL default '0', `bShort` varchar(16) default NULL, PRIMARY KEY (`bId`), KEY `sc_bookmarks_usd` (`uId`,`bStatus`,`bDatetime`), diff --git a/data/templates/default/dynamictags.inc.php b/data/templates/default/dynamictags.inc.php index c2ab6d4..f731048 100644 --- a/data/templates/default/dynamictags.inc.php +++ b/data/templates/default/dynamictags.inc.php @@ -53,7 +53,7 @@ JS; $taglist = ''; foreach (array_keys($tagsCloud) as $key) { $row = $tagsCloud[$key]; - $entries = T_ngettext('bookmark', 'bookmarks', $row['bCount']); + $entries = T_ngettext('bookmark', 'bookmarks', (int)$row['bCount']); $taglist .= '<span' . ' title="'. $row['bCount'] . ' ' . $entries . '"' . ' style="font-size:' . $row['size'] . '"' diff --git a/data/templates/default/sidebar.block.popular.php b/data/templates/default/sidebar.block.popular.php index 842aa60..83ad2fb 100644 --- a/data/templates/default/sidebar.block.popular.php +++ b/data/templates/default/sidebar.block.popular.php @@ -31,7 +31,7 @@ if ($popularTags && count($popularTags) > 0) { } foreach ($popularTags as $row) { - $entries = T_ngettext('bookmark', 'bookmarks', $row['bCount']); + $entries = T_ngettext('bookmark', 'bookmarks', (int)$row['bCount']); $contents .= '<a href="'. sprintf($cat_url, $user, filter($row['tag'], 'url')) .'" title="'. $row['bCount'] .' '. $entries .'" rel="tag" style="font-size:'. $row['size'] .'">'. filter($row['tag']) .'</a> '; } echo $contents ."\n"; diff --git a/data/templates/default/sidebar.block.recent.php b/data/templates/default/sidebar.block.recent.php index 80ae71c..1deae27 100644 --- a/data/templates/default/sidebar.block.recent.php +++ b/data/templates/default/sidebar.block.recent.php @@ -26,7 +26,7 @@ if ($recentTags && count($recentTags) > 0) { } foreach ($recentTags as $row) { - $entries = T_ngettext('bookmark', 'bookmarks', $row['bCount']); + $entries = T_ngettext('bookmark', 'bookmarks', (int)$row['bCount']); $contents .= '<a href="'. sprintf($cat_url, $user, filter($row['tag'], 'url')) .'" title="'. $row['bCount'] .' '. $entries .'" rel="tag" style="font-size:'. $row['size'] .'">'. filter($row['tag']) .'</a> '; } echo $contents ."</p>\n"; diff --git a/data/templates/default/tags.tpl.php b/data/templates/default/tags.tpl.php index d6259cc..dce5e1c 100644 --- a/data/templates/default/tags.tpl.php +++ b/data/templates/default/tags.tpl.php @@ -16,7 +16,7 @@ if ($tags && count($tags) > 0) { <?php $contents = ''; foreach ($tags as $row) { - $entries = T_ngettext('bookmark', 'bookmarks', $row['bCount']); + $entries = T_ngettext('bookmark', 'bookmarks', (int)$row['bCount']); $contents .= '<a href="'. sprintf($cat_url, $user, filter($row['tag'], 'url')) .'" title="'. $row['bCount'] .' '. $entries .'" rel="tag" style="font-size:'. $row['size'] .'">'. filter($row['tag']) .'</a> '; } echo $contents ."\n"; diff --git a/res/docs/header.tpl.html b/res/docs/header.tpl.html deleted file mode 100644 index ee0650f..0000000 --- a/res/docs/header.tpl.html +++ /dev/null @@ -1,8 +0,0 @@ -<ul class="menu"> - <li><a href="index.html">Index</a></li> - <li><a href="INSTALL.html">Installation</a></li> - <li><a href="UPGRADE.html">Upgrade</a></li> - <li><a href="ChangeLog.html">ChangeLog</a></li> - <li><a href="http://semanticscuttle.sourceforget.net/">Homepage</a></li> - <li><a href="https://sourceforget.net/projects/semanticscuttle">Project page</a></li> -</ul> diff --git a/res/docs/style.css b/res/docs/style.css deleted file mode 100644 index 90a3fbc..0000000 --- a/res/docs/style.css +++ /dev/null @@ -1,28 +0,0 @@ -/* SemanticScuttle improvements */ -.document { - max-width: 100ex; -} -h1.title { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAA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gso0xlvBGPzFKj86fYmny3PM3DGltx3ZV7u94NfeQnUWOzuK8YfxKnVsRyiO5ylMDJDJOSCdRdEQbwUBsIHXTWAJwAQNAs9nZfYqzaqL8QNM6BJUZwmrs2jk4Ycsn73Cv3/he3znmXOsdTp46CleBb7658e45f03R3fvG1w6Ks0lS1J5onSRVa/Jyqwhk0/hZKx4xTchrYCVBIG+shOBl4FaUJku2rkx6o0KUXM5PohtLqOqutrg1LMXefTTj/DDNbe/pe5/lNP3P8rpY29j/73v5oNHJhrvywSNiQgLK53HCzLxwa+JX46sNji3G4w7Hq+XS/IJVf5BBOnoWgGL5xZ57OEf8dh/PMdWu/mO+MQbkByw4R1ALo31qbt4x7uu5wMTg7zLknWgfsjyp77Nx//zeRaA09vVQrt6P/CZD8vv33CQo65P9acznP2n/+ZnftgtdXtFgWVgTlW7oSQiGeL/TlxDz+xy6xEGP/IObj48zlu8APeBJ3niJ+eptG8/r6oV+siuCIjIjRCfGW0jIfEx5WXV/i8nRESACWCSHq/0kZPb9bebWghgkf4E1oB5YElV+3mlK+3ibBFYFJECsVf298Gyth142KUHAERkEjgEpIA6cWwvbLVLeq0iIhYwRuyZQeKZZxV4VXXboz/+HwP+91Qbpr+OAAAAAElFTkSuQmCC"); - background-repeat: no-repeat; - padding-left: 64px; - padding-top: 0.2em; - margin-bottom: 00px; - height: 60px; - border-bottom: 3px solid #666; -} -h2 { - margin-top: 1.5em; - -} -pre { - padding: 1em; - background-color: #EEE; - border: 1px solid #BBB; - width: auto; -} - -tt, code { - background-color: #DDD; - padding: 0.2ex; -} diff --git a/src/SemanticScuttle/Service/Bookmark.php b/src/SemanticScuttle/Service/Bookmark.php index 1315350..39ec4f0 100644 --- a/src/SemanticScuttle/Service/Bookmark.php +++ b/src/SemanticScuttle/Service/Bookmark.php @@ -734,7 +734,7 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService $tags = explode('+', trim($tags)); } - $tagcount = count($tags); + $tagcount = empty($tags) ? 0 : count($tags); for ($i = 0; $i < $tagcount; $i ++) { $tags[$i] = trim($tags[$i]); } @@ -853,7 +853,7 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService $aTerms = array_map('trim', $aTerms); // Search terms in tags as well when none given - if (!count($tags)) { + if (!empty($tags)) { $query_2 .= ' LEFT JOIN '. $b2tservice->getTableName() .' AS T' . ' ON B.bId = T.bId'; $dotags = true; @@ -1136,7 +1136,7 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService // Delete final / if (substr($address, -1) == '/') { - $address = substr($address, 0, count($address)-2); + $address = substr($address, 0, strlen($address)-2); } return $address; diff --git a/src/SemanticScuttle/Service/Bookmark2Tag.php b/src/SemanticScuttle/Service/Bookmark2Tag.php index a01b5d7..2579022 100644 --- a/src/SemanticScuttle/Service/Bookmark2Tag.php +++ b/src/SemanticScuttle/Service/Bookmark2Tag.php @@ -691,14 +691,12 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService } if ($sortOrder == 'alphabet_asc') { - usort($output, create_function('$a,$b','return strcasecmp(utf8_deaccent($a["tag"]), utf8_deaccent($b["tag"]));')); + usort($output, "cmp"); } return $output; } - - /** * Deletes all tags in bookmarks2tags * @@ -711,4 +709,10 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService } } + +function cmp($a,$b) +{ + return strcasecmp(utf8_deaccent($a["tag"]), utf8_deaccent($b["tag"])); +} + ?> diff --git a/www/.htaccess b/www/.htaccess index 563fe53..65447f5 100644 --- a/www/.htaccess +++ b/www/.htaccess @@ -6,7 +6,7 @@ # Rewrite clean URLs onto real files <IfModule mod_rewrite.c> -Options +FollowSymlinks +Options -MultiViews +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^([^/.]+)/?(.*)$ /$1.php/$2 [QSA,L] -- cgit v1.2.3