PHP 7.3 compat, bug fixes

This commit is contained in:
querwurzelt 2019-01-20 22:19:33 +01:00
parent e636523aac
commit ea04385bc1
16 changed files with 45 additions and 58 deletions

16
README.md Normal file
View file

@ -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

1
cache/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*.cache

3
cache/.htaccess vendored
View file

@ -1,2 +1 @@
order allow,deny Require all denied
deny from all

View file

@ -115,7 +115,7 @@ $usecache = false;
* *
* @var string * @var string
*/ */
$dir_cache = dirname(__FILE__) . '/cache/'; $dir_cache = dirname(__DIR__, 1) . '/cache';
/** /**
* Use clean urls without .php filenames. * Use clean urls without .php filenames.
@ -149,14 +149,14 @@ $debugMode = false;
* *
* @var string * @var string
*/ */
$dbtype = 'mysql4'; $dbtype = 'mysqli';
/** /**
* Database hostname/IP * Database hostname/IP
* *
* @var string * @var string
*/ */
$dbhost = '127.0.0.1'; $dbhost = 'localhost';
/** /**
* Database port. * Database port.

View file

@ -46,7 +46,7 @@ $cleanurls = false;
* *
* @var boolean * @var boolean
*/ */
$debugMode = true; $debugMode = false;
/*************************************************** /***************************************************
@ -62,7 +62,7 @@ $debugMode = true;
* *
* @var string * @var string
*/ */
$dbtype = 'mysql4'; $dbtype = 'mysqli';
/** /**
* Database username * Database username
* *
@ -89,7 +89,7 @@ $dbname = 'scuttle';
* *
* @var string * @var string
*/ */
$dbhost = '127.0.0.1'; $dbhost = 'localhost';
/*************************************************** /***************************************************

View file

@ -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` ( CREATE TABLE `sc_tagscache` (
`tcId` int(11) NOT NULL auto_increment, `tcId` int(11) NOT NULL auto_increment,
`tag1` varchar(100) NOT NULL default '', `tag1` varchar(100) NOT NULL default '',

View file

@ -5,6 +5,9 @@
-- Table structure for table `sc_bookmarks` -- Table structure for table `sc_bookmarks`
-- --
# to avoid STRICT_TRANS_TABLES mode
SET sql_mode = '';
CREATE TABLE `sc_bookmarks` ( CREATE TABLE `sc_bookmarks` (
`bId` int(11) NOT NULL auto_increment, `bId` int(11) NOT NULL auto_increment,
`uId` int(11) NOT NULL default '0', `uId` int(11) NOT NULL default '0',
@ -17,8 +20,8 @@ CREATE TABLE `sc_bookmarks` (
`bDescription` text default NULL, `bDescription` text default NULL,
`bPrivateNote` text default NULL, `bPrivateNote` text default NULL,
`bHash` varchar(32) NOT NULL default '', `bHash` varchar(32) NOT NULL default '',
`bVotes` int(11) NOT NULL, `bVotes` int(11) NOT NULL default '0',
`bVoting` int(11) NOT NULL, `bVoting` int(11) NOT NULL default '0',
`bShort` varchar(16) default NULL, `bShort` varchar(16) default NULL,
PRIMARY KEY (`bId`), PRIMARY KEY (`bId`),
KEY `sc_bookmarks_usd` (`uId`,`bStatus`,`bDatetime`), KEY `sc_bookmarks_usd` (`uId`,`bStatus`,`bDatetime`),

View file

@ -53,7 +53,7 @@ JS;
$taglist = ''; $taglist = '';
foreach (array_keys($tagsCloud) as $key) { foreach (array_keys($tagsCloud) as $key) {
$row = $tagsCloud[$key]; $row = $tagsCloud[$key];
$entries = T_ngettext('bookmark', 'bookmarks', $row['bCount']); $entries = T_ngettext('bookmark', 'bookmarks', (int)$row['bCount']);
$taglist .= '<span' $taglist .= '<span'
. ' title="'. $row['bCount'] . ' ' . $entries . '"' . ' title="'. $row['bCount'] . ' ' . $entries . '"'
. ' style="font-size:' . $row['size'] . '"' . ' style="font-size:' . $row['size'] . '"'

View file

@ -31,7 +31,7 @@ if ($popularTags && count($popularTags) > 0) {
} }
foreach ($popularTags as $row) { 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> '; $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"; echo $contents ."\n";

View file

@ -26,7 +26,7 @@ if ($recentTags && count($recentTags) > 0) {
} }
foreach ($recentTags as $row) { 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> '; $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"; echo $contents ."</p>\n";

View file

@ -16,7 +16,7 @@ if ($tags && count($tags) > 0) {
<?php <?php
$contents = ''; $contents = '';
foreach ($tags as $row) { 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> '; $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"; echo $contents ."\n";

View file

@ -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>

View file

@ -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/0iqDK0L4slAZgA1Af1yeaFVMaQGXsrqe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ZZxV4VXXboz/+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;
}

View file

@ -734,7 +734,7 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
$tags = explode('+', trim($tags)); $tags = explode('+', trim($tags));
} }
$tagcount = count($tags); $tagcount = empty($tags) ? 0 : count($tags);
for ($i = 0; $i < $tagcount; $i ++) { for ($i = 0; $i < $tagcount; $i ++) {
$tags[$i] = trim($tags[$i]); $tags[$i] = trim($tags[$i]);
} }
@ -853,7 +853,7 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
$aTerms = array_map('trim', $aTerms); $aTerms = array_map('trim', $aTerms);
// Search terms in tags as well when none given // Search terms in tags as well when none given
if (!count($tags)) { if (!empty($tags)) {
$query_2 .= ' LEFT JOIN '. $b2tservice->getTableName() .' AS T' $query_2 .= ' LEFT JOIN '. $b2tservice->getTableName() .' AS T'
. ' ON B.bId = T.bId'; . ' ON B.bId = T.bId';
$dotags = true; $dotags = true;
@ -1136,7 +1136,7 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
// Delete final / // Delete final /
if (substr($address, -1) == '/') { if (substr($address, -1) == '/') {
$address = substr($address, 0, count($address)-2); $address = substr($address, 0, strlen($address)-2);
} }
return $address; return $address;

View file

@ -691,14 +691,12 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
} }
if ($sortOrder == 'alphabet_asc') { 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; return $output;
} }
/** /**
* Deletes all tags in bookmarks2tags * 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"]));
}
?> ?>

View file

@ -6,7 +6,7 @@
# Rewrite clean URLs onto real files # Rewrite clean URLs onto real files
<IfModule mod_rewrite.c> <IfModule mod_rewrite.c>
Options +FollowSymlinks Options -MultiViews +FollowSymlinks
RewriteEngine On RewriteEngine On
RewriteCond %{REQUEST_FILENAME}.php -f RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^/.]+)/?(.*)$ /$1.php/$2 [QSA,L] RewriteRule ^([^/.]+)/?(.*)$ /$1.php/$2 [QSA,L]