Sync with SebSauvage repo

This commit is contained in:
Knah Tsaeb 2013-09-27 09:38:01 +02:00
parent bd5d37d0ba
commit 6f5933d23f
14 changed files with 147 additions and 201 deletions

View file

@ -1,7 +1,6 @@
![Shaarli logo](http://sebsauvage.net/wiki/lib/exe/fetch.php?media=php:php_shaarli:php_shaarli_logo_inkscape_w600_transp-nq8.png)
Shaarli
The personal, minimalist, super-fast, no-database delicious clone.
Shaarli, the personal, minimalist, super-fast, no-database delicious clone.
You want to share the links you discover ? Shaarli is a minimalist delicious clone you can install on your own website.
It is designed to be personal (single-user), fast and handy.
@ -10,36 +9,37 @@ It is designed to be personal (single-user), fast and handy.
Features:
* Minimalist design (simple is beautiful)
* FAST
* **FAST**
* Dead-simple installation: Drop the files, open the page. No database required.
* Easy to use: Single button in your browser to bookmark a page
* Save url, title, description (unlimited size). Classify links with tags (with autocomplete)
* Tag renaming, merging and deletion.
* Automatic thumbnails for various services (imgur, imageshack.us, flickr, youtube, vimeo, dailymotion…)
* Automatic conversion of URLs to clickable links in descriptions. Support for http/ftp/file/apt protocols.
* Automatic conversion of URLs to clickable links in descriptions. Support for http/ftp/file/apt/magnet protocols.
* Save links as public or private
* 1-clic access to your private links/notes
* Browse links by page, filter by tag or use the full text search engine
* Permalinks (with QR-Code) for easy reference
* RSS and ATOM feeds (which can be filtered by tag or text search)
* Tag cloud
* Picture wall (which can be filtered by tag or text search)
* “Links of the day” Newspaper-like digest, browsable by day.
* “Daily” RSS feed: Get each day a digest of all new links.
* RSS and ATOM feeds (which can be filtered by tag or text search)
* PubSubHubbub protocol support
* [PubSubHubbub](https://code.google.com/p/pubsubhubbub/) protocol support
* Easy backup (Data stored in a single file)
* Compact storage (1315 links stored in 150 kb)
* Mobile browsers support
* Also works with javascript disabled
* Can import/export Netscape bookmarks (for import/export from/to Firefox, Opera, Chrome, Delicious…)
* Automatic ban of IP address upon too many failed logins
* Protected against XSRF, session cookie hijacking.
* Brute force protected login form
* Protected against [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery), session cookie hijacking.
* Automatic removal of annoying FeedBurner/Google FeedProxy parameters in URL (?utm_source…)
* Shaarli is a bookmarking application, but you can use it for micro-blogging (like Twitter), a pastebin, an online notepad, a snippet repository, etc.
* You will be automatically notified by a discreet popup if a new version is available
* Pages are easy to customize (using simple RainTPL templates)
* Pages are easy to customize (using CSS and simple RainTPL templates)
Requires php 5.1 (php 5.2 required for autocomplete.)
Requires php 5.1
More information on the project page:
http://sebsauvage.net/wiki/doku.php?id=php:shaarli

View file

@ -1,108 +0,0 @@
/*
* jQuery Highlight plugin
*
* Based on highlight v3 by Johann Burkard
* http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html
*
* Code a little bit refactored and cleaned (in my humble opinion).
* Most important changes:
* - has an option to highlight only entire words (wordsOnly - false by default),
* - has an option to be case sensitive (caseSensitive - false by default)
* - highlight element tag and class names can be specified in options
*
* Usage:
* // wrap every occurrance of text 'lorem' in content
* // with <span class='highlight'> (default options)
* $('#content').highlight('lorem');
*
* // search for and highlight more terms at once
* // so you can save some time on traversing DOM
* $('#content').highlight(['lorem', 'ipsum']);
* $('#content').highlight('lorem ipsum');
*
* // search only for entire word 'lorem'
* $('#content').highlight('lorem', { wordsOnly: true });
*
* // don't ignore case during search of term 'lorem'
* $('#content').highlight('lorem', { caseSensitive: true });
*
* // wrap every occurrance of term 'ipsum' in content
* // with <em class='important'>
* $('#content').highlight('ipsum', { element: 'em', className: 'important' });
*
* // remove default highlight
* $('#content').unhighlight();
*
* // remove custom highlight
* $('#content').unhighlight({ element: 'em', className: 'important' });
*
*
* Copyright (c) 2009 Bartek Szopka
*
* Licensed under MIT license.
*
*/
jQuery.extend({
highlight: function (node, re, nodeName, className) {
if (node.nodeType === 3) {
var match = node.data.match(re);
if (match) {
var highlight = document.createElement(nodeName || 'span');
highlight.className = className || 'highlight';
var wordNode = node.splitText(match.index);
wordNode.splitText(match[0].length);
var wordClone = wordNode.cloneNode(true);
highlight.appendChild(wordClone);
wordNode.parentNode.replaceChild(highlight, wordNode);
return 1; //skip added node in parent
}
} else if ((node.nodeType === 1 && node.childNodes) && // only element nodes that have children
!/(script|style)/i.test(node.tagName) && // ignore script and style nodes
!(node.tagName === nodeName.toUpperCase() && node.className === className)) { // skip if already highlighted
for (var i = 0; i < node.childNodes.length; i++) {
i += jQuery.highlight(node.childNodes[i], re, nodeName, className);
}
}
return 0;
}
});
jQuery.fn.unhighlight = function (options) {
var settings = { className: 'highlight', element: 'span' };
jQuery.extend(settings, options);
return this.find(settings.element + "." + settings.className).each(function () {
var parent = this.parentNode;
parent.replaceChild(this.firstChild, this);
parent.normalize();
}).end();
};
jQuery.fn.highlight = function (words, options) {
var settings = { className: 'highlight', element: 'span', caseSensitive: false, wordsOnly: false };
jQuery.extend(settings, options);
if (words.constructor === String) {
words = [words];
}
words = jQuery.grep(words, function(word, i){
return word != '';
});
words = jQuery.map(words, function(word, i) {
return word.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
});
if (words.length == 0) { return this; };
var flag = settings.caseSensitive ? "" : "i";
var pattern = "(" + words.join("|") + ")";
if (settings.wordsOnly) {
pattern = "\\b" + pattern + "\\b";
}
var re = new RegExp(pattern, flag);
return this.each(function () {
jQuery.highlight(this, re, settings.element, settings.className);
});
};

9
inc/qr.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -132,8 +132,6 @@ cursor:pointer;
text-decoration:none;
}
.shareYourLink {float:right; font-style:italic; color:#bbb; text-align:right; padding:0 5 0 0;}
#toolsdiv a{
clear:both;
}
@ -208,7 +206,7 @@ cursor:pointer;
#paging_older { margin-right:15px; }
#paging_newer { margin-left:15px; }
#headerform { color:#ffffff; padding:5px 5px 5px 5px; clear: both; width:100%; white-space:nowrap;}
#headerform { color:#ffffff; padding:5px 5px 5px 5px; clear: both;}
#toolsdiv { color:#ffffff; padding:5px 5px 5px 5px; clear:left; }
#uploaddiv { color:#ffffff; padding:5px 5px 5px 5px; clear:left; }
#editlinkform { height:100%;color:#ffffff; padding:5px 5px 5px 15px; width:80%; clear:left; }
@ -273,8 +271,7 @@ font-size:9pt;
#footer a:hover{ color:#000000;}
#newversion { background-color: #FFFFA0; color:#000; position:absolute; top:0;right:0; padding:2 7 2 7; font-size:9pt;}
#cloudtag { padding-left:10%; padding-right:10%; }
#cloudtag a { font-weight:bold; color:black; text-decoration:none }
#cloudtag span { color:#99f; font-size:9pt; padding-left:5px; padding-right:2px;}
#cloudtag a { color:black; text-decoration:none; }
#installform td { font-size: 10pt; color:black; padding:10px 5px 10px 5px; clear:left; }
#changepasswordform { color:#ccc; padding:10px 5px 10px 5px; clear:left; }
#changetag { color:#ccc; padding:10px 5px 10px 5px; clear:left; }
@ -319,7 +316,8 @@ text-shadow:2px 2px 1px #000000;
background: #ffffff;
}
div.qrcode {
div#permalinkQrcode {
padding:20px;
width:220px;
height:220px;
background-color: #ffffff;

View file

@ -740,7 +740,7 @@ class linkdb implements Iterator, Countable, ArrayAccess
$this->links = array();
$link = array('title'=>'Shaarli - sebsauvage.net','url'=>'http://sebsauvage.net/wiki/doku.php?id=php:shaarli','description'=>'Welcome to Shaarli ! This is a bookmark. To edit or delete me, you must first login.','private'=>0,'linkdate'=>'20110914_190000','tags'=>'opensource software');
$this->links[$link['linkdate']] = $link;
$link = array('title'=>'My secret stuff... - Pastebin.com','url'=>'http://pastebin.com/smCEEeSn','description'=>'SShhhh!! I\'m a private link only YOU can see. You can delete me too.','private'=>1,'linkdate'=>'20110914_074522','tags'=>'secretstuff');
$link = array('title'=>'My secret stuff... - Pastebin.com','url'=>'http://sebsauvage.net/paste/?8434b27936c09649#bR7XsXhoTiLcqCpQbmOpBi3rq2zzQUC5hBI7ZT1O3x8=','description'=>'SShhhh!! I\'m a private link only YOU can see. You can delete me too.','private'=>1,'linkdate'=>'20110914_074522','tags'=>'secretstuff');
$this->links[$link['linkdate']] = $link;
file_put_contents($GLOBALS['config']['DATASTORE'], PHPPREFIX.base64_encode(gzdeflate(serialize($this->links))).PHPSUFFIX); // Write database to disk
}
@ -898,7 +898,11 @@ function showRSS()
if (!empty($_GET['searchterm'])) $linksToDisplay = $LINKSDB->filterFulltext($_GET['searchterm']);
elseif (!empty($_GET['searchtags'])) $linksToDisplay = $LINKSDB->filterTags(trim($_GET['searchtags']));
else $linksToDisplay = $LINKSDB;
$nblinksToDisplay = !empty($_GET['nb']) ? max($_GET['nb'] + 0, 1) : 50;
$nblinksToDisplay = 50; // Number of links to display.
if (!empty($_GET['nb'])) // In URL, you can specificy the number of links. Example: nb=200 or nb=all for all links.
{
$nblinksToDisplay = $_GET['nb']=='all' ? count($linksToDisplay) : max($_GET['nb']+0,1) ;
}
$pageaddr=htmlspecialchars(indexUrl());
echo '<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">';
@ -969,7 +973,11 @@ function showATOM()
if (!empty($_GET['searchterm'])) $linksToDisplay = $LINKSDB->filterFulltext($_GET['searchterm']);
elseif (!empty($_GET['searchtags'])) $linksToDisplay = $LINKSDB->filterTags(trim($_GET['searchtags']));
else $linksToDisplay = $LINKSDB;
$nblinksToDisplay = !empty($_GET['nb']) ? max($_GET['nb'] + 0, 1) : 50;
$nblinksToDisplay = 50; // Number of links to display.
if (!empty($_GET['nb'])) // In URL, you can specificy the number of links. Example: nb=200 or nb=all for all links.
{
$nblinksToDisplay = $_GET['nb']=='all' ? count($linksToDisplay) : max($_GET['nb']+0,1) ;
}
$pageaddr=htmlspecialchars(indexUrl());
$latestDate = '';

View file

@ -1,6 +1,8 @@
<!DOCTYPE html>
<html>
<head>{include="includes"}</head>
<head>{include="includes"}
{if="empty($GLOBALS['disablejquery'])"}<script src="inc/jquery.min.js#"></script><script src="inc/jquery-ui.min.js#"></script>{/if}
</head>
<body onload="document.changetag.fromtag.focus();">
<div id="pageheader">
{include="page.header"}
@ -12,5 +14,13 @@
<script language="JavaScript">function confirmDeleteTag() { var agree=confirm("Are you sure you want to delete this tag from all links ?"); if (agree) return true ; else return false ; }</script>
</div>
{include="page.footer"}
{if="($GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn()) && empty($GLOBALS['disablejquery'])"}
<script language="JavaScript">
$(document).ready(function()
{
$('#fromtag').autocomplete({source:'{$source}?ws=singletag',minLength:1});
});
</script>
{/if}
</body>
</html>

View file

@ -1,6 +1,8 @@
<!DOCTYPE html>
<html>
<head>{include="includes"}</head>
<head>{include="includes"}
{if="empty($GLOBALS['disablejquery'])"}<script src="inc/jquery.min.js#"></script><script src="inc/jquery-ui.min.js#"></script>{/if}
</head>
<body
{if condition="$link.title==''"}onload="document.linkform.lf_title.focus();"
{elseif condition="$link.description==''"}onload="document.linkform.lf_description.focus();"
@ -30,5 +32,13 @@
</div>
</div>
{include="page.footer"}
{if="($GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn()) && empty($GLOBALS['disablejquery'])"}
<script language="JavaScript">
$(document).ready(function()
{
$('#lf_tags').autocomplete({source:'{$source}?ws=tags',minLength:1});
});
</script>
{/if}
</body>
</html>

View file

@ -7,4 +7,3 @@
<link href="images/favicon.ico#" rel="shortcut icon" type="image/x-icon" />
<link type="text/css" rel="stylesheet" href="inc/shaarli.css?version={$version|urlencode}#" />
{if condition="is_file('inc/user.css')"}<link type="text/css" rel="stylesheet" href="inc/user.css?version={$version}#" />{/if}
{if="empty($GLOBALS['disablejquery'])"}<script src="inc/jquery.min.js#"></script><script src="inc/jquery-ui.min.js#"></script>{/if}

View file

@ -4,7 +4,7 @@
<body>
<div id="pageheader">
{include="page.header"}
<div id="headerform">
<div id="headerform" style="width:100%; white-space:nowrap;">
<form method="GET" class="searchform" name="searchform" style="display:inline;"><input type="text" id="searchform_value" name="searchterm" style="width:30%" value=""> <input type="submit" value="Search" class="bigbutton"></form>
<form method="GET" class="tagfilter" name="tagfilter" style="display:inline;margin-left:24px;"><input type="text" name="searchtags" id="tagfilter_value" style="width:10%" value=""> <input type="submit" value="Filter by tag" class="bigbutton"></form>
</div>
@ -48,8 +48,8 @@
{else}
<span class="linkdate" title="Short link here"><a href="?{$value.linkdate|smallHash}">permalink</a> - </span>
{/if}
<div style="position:relative;display:inline;"><a href="http://invx.com/code/qrcode/?code={$scripturl|urlencode}%3F{$value.linkdate|smallHash}&width=200&height=200"
{if="empty($GLOBALS['disablejquery'])"}onclick="return false;"{/if} class="qrcode"><img src="images/qrcode.png#" width="13" height="13" title="QR-Code"></a></div> -
<div style="position:relative;display:inline;"><a href="http://qrfree.kaywa.com/?l=1&s=8&d={$scripturl|urlencode}%3F{$value.linkdate|smallHash}"
onclick="showQrCode(this); return false;" class="qrcode" data-permalink="{$scripturl}?{$value.linkdate|smallHash}"><img src="images/qrcode.png#" width="13" height="13" title="QR-Code"></a></div> -
<span class="linkurl" title="Short link">{$value.url|htmlspecialchars}</span><br>
{if="$value.tags"}
<div class="linktaglist">
@ -66,17 +66,56 @@
</div>
{include="page.footer"}
{if="empty($GLOBALS['disablejquery'])"}
<script>
$(document).ready(function() {
$('a.qrcode').click(function(){
hide_qrcode();
var link = $(this).attr('href');
$(this).after('<div class="qrcode" onclick="hide_qrcode();return false;"><img src="'+link+'#" width="200" height="200"><br>click to close</div>');
});
});
function hide_qrcode() { $('div.qrcode').remove(); }
<script language="JavaScript">
// Remove any displayed QR-Code
function remove_qrcode()
{
var elem = document.getElementById("permalinkQrcode");
if (elem) elem.parentNode.removeChild(elem);
return false;
}
// Show the QR-Code of a permalink (when the QR-Code icon is clicked).
function showQrCode(caller,loading=false)
{
// Dynamic javascript lib loading: We only load qr.js if the QR code icon is clicked:
if (typeof(qr)=='undefined') // Load qr.js only if not present.
{
if (!loading) // If javascript lib is still loading, do not append script to body.
{
var element = document.createElement("script");
element.src = "inc/qr.min.js";
document.body.appendChild(element);
}
setTimeout(function() { showQrCode(caller,true);}, 200); // Retry in 200 milliseconds.
return false;
}
// Remove previous qrcode if present.
remove_qrcode();
// Build the div which contains the QR-Code:
var element = document.createElement('div');
element.id="permalinkQrcode";
// Make QR-Code div commit sepuku when clicked:
if ( element.attachEvent ){ element.attachEvent('onclick', 'this.parentNode.removeChild(this);' ); } // Damn IE
else { element.setAttribute('onclick', 'this.parentNode.removeChild(this);' ); }
// Build the QR-Code:
var image = qr.image({size: 8,value: caller.dataset.permalink});
if (image)
{
element.appendChild(image);
element.innerHTML+= "<br>Click to close";
caller.parentNode.appendChild(element);
}
else
{
element.innerHTML="Your browser does not seem to be HTML5 compatible.";
}
return false;
}
</script>
{/if}
</body>
</html>

View file

@ -13,7 +13,7 @@
Login: <input type="text" name="login" tabindex="1">&nbsp;&nbsp;&nbsp;
Password : <input type="password" name="password" tabindex="2">
<input type="submit" value="Login" class="bigbutton" tabindex="4"><br>
<input type="checkbox" name="longlastingsession" id="longlastingsession" tabindex="3"><label for="longlastingsession">&nbsp;Stay signed in (Do not check on public computers)</label>
<input style="margin:10 0 0 40;" type="checkbox" name="longlastingsession" id="longlastingsession" tabindex="3"><label for="longlastingsession">&nbsp;Stay signed in (Do not check on public computers)</label>
<input type="hidden" name="token" value="{$token}">
{if="$returnurl"}<input type="hidden" name="returnurl" value="{$returnurl|htmlspecialchars}">{/if}
</form>

View file

@ -7,24 +7,3 @@
{if="isLoggedIn()"}
<script language="JavaScript">function confirmDeleteLink() { var agree=confirm("Are you sure you want to delete this link ?"); if (agree) return true ; else return false ; }</script>
{/if}
{if="($GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn()) && empty($GLOBALS['disablejquery'])"}
<script language="JavaScript">
$(document).ready(function()
{
$('#lf_tags').autocomplete({source:'{$source}?ws=tags',minLength:1});
$('#searchtags').autocomplete({source:'{$source}?ws=tags',minLength:1});
$('#fromtag').autocomplete({source:'{$source}?ws=singletag',minLength:1});
});
</script>
{/if}
{if="empty($GLOBALS['disablejquery']) && isset($_GET['searchterm'])"}
<script src="inc/jquery.highlight.js#"></script>
<script language="JavaScript">
$(document).ready(function()
{
$('#linklist li').highlight("{$search_crits}");
});
</script>
{/if}

View file

@ -1,6 +1,6 @@
<div id="logo" title="Share your links !" onclick="document.location='?';"></div>
<div class="nomobile shareYourLink">Shaare your links...<br>
<div style="float:right; font-style:italic; color:#bbb; text-align:right; padding:0 5 0 0;" class="nomobile">Shaare your links...<br>
{if="!empty($linkcount)"}{$linkcount} links{/if}</div>
<span id="shaarli_title"><a href="?">{$shaarlititle|htmlspecialchars}</a></span>
@ -16,7 +16,7 @@
<a href="?do=login">Login</a>
{/if}
<a href="{$feedurl}?do=rss{$searchcrits}" class="nomobile">RSS Feed</a>
<a href="{$feedurl}?do=atom{$searchcrits}" class="nomobile">ATOM Feed</a>
<a href="{$feedurl}?do=atom{$searchcrits}" style="padding-left:10px;" class="nomobile">ATOM Feed</a>
<a href="?do=tagcloud">Tag cloud</a>
<a href="?do=picwall{$searchcrits}">Picture wall</a>
<a href="?do=daily">Daily</a>

View file

@ -2,7 +2,9 @@
<html>
<head>{include="includes"}
{if="empty($GLOBALS['disablejquery'])"}
<script src="inc/jquery.lazyload.min.js#"></script>
<script src="inc/jquery.min.js#"></script>
<script src="inc/jquery-ui.min.js#"></script>
<script src="inc/jquery.lazyload.min.js#"></script>
{/if}
</head>
<body>

View file

@ -6,7 +6,7 @@
<center>
<div id="cloudtag">
{loop="tags"}
<span>{$value.count}</span><a href="?searchtags={$key|htmlspecialchars}" style="font-size:{$value.size}pt;">{$key|htmlspecialchars}</a>
<span style="color:#99f; font-size:9pt; padding-left:5px; padding-right:2px;">{$value.count}</span><a href="?searchtags={$key|htmlspecialchars}" style="font-size:{$value.size}pt; font-weight:bold; color:black; text-decoration:none">{$key|htmlspecialchars}</a>
{/loop}
</div>
</center>