From ea04385bc16de6b7b65aab75c5c33cfe2d71ea84 Mon Sep 17 00:00:00 2001 From: querwurzelt <> Date: Sun, 20 Jan 2019 22:19:33 +0100 Subject: [PATCH] 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 +- .../default/sidebar.block.popular.php | 2 +- .../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 .= ' 0) { } foreach ($popularTags as $row) { - $entries = T_ngettext('bookmark', 'bookmarks', $row['bCount']); + $entries = T_ngettext('bookmark', 'bookmarks', (int)$row['bCount']); $contents .= ' '; } 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 .= ' '; } echo $contents ."

\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) { '. filter($row['tag']) .' '; } 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 @@ - 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,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAsvSURBVGiBxZprjCRXdcd/p6r6Nd0979mHZ+3sCkfx4AdJsAhGm2BMYhAbrAgsEimKjGIlxELk8SkrQoQiSGgrCSJZh9hECsQ8hJCQlRDjYDsY4RAvRF6b9drN2t7HzOzOzmtnpl/V1fW4Jx+qu6emZ3pmbI/kI7Wq+9Ste///87j33FstqspeS7kkR4HPAAeAx4G/mDqu9T0fCJC9JlAuyXuB72Ymbklnxt9K/fxjmFblf4A7p45rc08HA6y97KxcksPAI5mJW9JDN99DbvI2Rt7+CSSVPwo8tJdjdWRPCQAPWZmhYuHn70LwyeQFOzvC4C/cDfB75ZL85h6Pt3cEyiW5B7gzf+T9ABRGM+SHHFIZQ3p8isz4TajyYLkkQ3s1JuwRgXJJ9gGfT49NkSpeQzYvpDMKxic/kkLUp3D9MaxUbhL4u70YsyN75YH7xcmN5q75FUQCCqNp0BaYFraE5IdTiJUmf+ROVLm3XJLb9mjcN06gXJJ3Avdk9/0iqDK0L4slAZgA1Af1yeaFVMaQGXsrqeKkGOWBckn2xHhvqJNySQQ4YWVHxRk8RCYvZHICptX1ACYmURhLo8Zj4OfegyXyy8C9bzoB4GPArZmxKYg8hvbn2lYP2sCDLgnHMQwMOtjZETLjN2IMnyuXZORNI1AuyU3A553CJOJkKY5ncZxog9W7V/XBtOKExid78Fbs9MCYUf71TSHQBv8tSeVzTnESJxVSnMgkgLfWwyhBxCJgcF8WEPJxKP1WuSSfLZdk8PUS2FUpUS7JAeCdwG3AMeBGsbOkhg5jpXNM3nQd6YEsiAU48VVsoH0VC7Db323WrtRor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VMORHcwzuK5IZcLYIL4NldQwBjr2HBERsxNq8iEVBQG2pSn25hgkCTFAnqM4QuUto1DkZFKx0ATs3Ri0coba4RibvMLS/SH4kF3u23a9lxTmgqjgWOUBExOktH14LgWx86cR63LlXaVBfqeFVXTSKCN0Fgso0xlvBGPzFKj86fYmny3PM3DGltx3ZV7u94NfeQnUWOzuK8YfxKnVsRyiO5ylMDJDJOSCdRdEQbwUBsIHXTWAJwAQNAs9nZfYqzaqL8QNM6BJUZwmrs2jk4Ycsn73Cv3/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 -Options +FollowSymlinks +Options -MultiViews +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^([^/.]+)/?(.*)$ /$1.php/$2 [QSA,L]