From c677013b9376a3054750badf97f7d1e73aa37735 Mon Sep 17 00:00:00 2001 From: Sebastien SAUVAGE Date: Tue, 24 Sep 2013 22:39:40 +0200 Subject: [PATCH 1/8] Added nb=all to get all links in RSS/ATOM feed. --- index.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index d9181b6..396b97f 100644 --- a/index.php +++ b/index.php @@ -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 ''; @@ -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 = ''; From 58a8f4cab466446499cdda0cce000a82bd486105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20SAUVAGE?= Date: Wed, 25 Sep 2013 10:41:31 +0200 Subject: [PATCH 2/8] Default example private link changed Default example private link changed from pastebin to ZeroBin. --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index 396b97f..23a6294 100644 --- a/index.php +++ b/index.php @@ -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 } From 83cff11de5fac834ab224ed658b821676a6d54a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20SAUVAGE?= Date: Wed, 25 Sep 2013 14:57:27 +0200 Subject: [PATCH 3/8] Added javascript QR-Code library --- inc/qr.min.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 inc/qr.min.js diff --git a/inc/qr.min.js b/inc/qr.min.js new file mode 100644 index 0000000..663ce93 --- /dev/null +++ b/inc/qr.min.js @@ -0,0 +1,9 @@ +// [qr.js](http://neocotic.com/qr.js) 1.0.3 +// (c) 2011 Alasdair Mercer +// Freely distributable under the MIT license. +// Based on jsqrencode +// (c) 2010 tz@execpc.com +// Licensed under the GPL Version 3 license. +// For all details and documentation: +// http://neocotic.com/qr.js +(function(a){function Q(a){var c,h,i,j,k,m,n,u;k=a.length;C=0;do{C++;i=(r-1)*4+(C-1)*16;z=d[i++];A=d[i++];o=d[i++];p=d[i];i=o*(z+A)+A-3+(C<=9);if(k<=i)break}while(C<40);D=17+4*C;m=o+(o+p)*(z+A)+A;for(k=0;k1){k=b[C];u=D-7;for(;;){n=D-7;while(n>k-3){J(n,u);if(n6){k=l[C-7];i=17;for(n=0;n<6;n++){for(u=0;u<3;u++,i--){if(1&(i>11?C>>i-12:k>>i)){s[5-n+D*(2-u+D-11)]=1;s[2-u+D-11+D*(5-n)]=1}else{I(5-n,2-u+D-11);I(2-u+D-11,5-n)}}}}for(u=0;u=n-2){m=n-2;if(C>9)m--}c=m;if(C>9){B[c+2]=0;B[c+3]=0;while(c--){k=B[c];B[c+3]|=255&k<<4;B[c+2]=k>>4}B[2]|=255&m<<4;B[1]=m>>4;B[0]=64|m>>12}else{B[c+1]=0;B[c+2]=0;while(c--){k=B[c];B[c+2]|=255&k<<4;B[c+1]=k>>4}B[1]|=255&m<<4;B[0]=64|m>>4}c=m+3-(C<10);while(c0;h--){x[h]=x[h]?x[h-1]^f[K(g[x[h]]+c)]:x[h-1]}x[0]=f[K(g[x[0]]+c)]}for(c=0;c<=p;c++)x[c]=g[x[c]];i=n;u=0;for(c=0;c>=1){if(u&1){s[D-1-i+D*8]=1;if(i<6){s[8+D*i]=1}else{s[8+D*(i+1)]=1}}}for(i=0;i<7;i++,u>>=1){if(u&1){s[8+D*(D-7+i)]=1;if(i){s[6-i+D*8]=1}else{s[7+D*8]=1}}}return s}function P(){var a,b,c,d,e,f,g=0,h=0,j=0;for(f=0;fD*D){c-=D*D;j++}g+=j*k;for(e=0;e=5)b+=h+m[c]-5}for(c=3;ca||m[c-3]*3>=m[c]*4||m[c+3]*3>=m[c]*4)){b+=j}}return b}function N(a){var b,c,d,e;switch(a){case 0:for(c=0;c>1&1,b=0;bb){c=a;a=b;b=c}c=b;c+=b*b;c>>=1;c+=a;return t[c]}function L(a,b,c,d){var e,h,i;for(h=0;h=255){a-=255;a=(a>>8)+(a&255)}return a}function J(a,b){var c;s[a+D*b]=1;for(c=-2;c<2;c++){s[a+c+D*(b-2)]=1;s[a-2+D*(b+c+1)]=1;s[a+2+D*(b+c)]=1;s[a+c+1+D*(b+2)]=1}for(c=0;c<2;c++){I(a-1,b+c);I(a+1,b-c);I(a-c,b-1);I(a+c,b+1)}}function I(a,b){var c;if(a>b){c=a;a=b;b=c}c=b;c*=b;c+=b;c>>=1;c+=a;t[c]=1}function H(a,b,c){try{var d=a.apply(c||this);if(typeof b==="function")return b(null,d);return d}catch(e){if(typeof b==="function")return b(e);throw e}}function G(){for(var a=arguments.length;a>=0;--a){if(typeof arguments[a]==="function")return arguments[a]}}function F(){return w?new v:a.document.createElement("img")}function E(){return w?new n:a.document.createElement("canvas")}var b=[0,11,15,19,23,27,31,16,18,20,22,24,26,28,20,22,24,24,26,28,28,22,24,24,26,26,28,28,24,24,26,26,26,28,28,24,26,26,26,28,28],c="image/octet-stream",d=[1,0,19,7,1,0,16,10,1,0,13,13,1,0,9,17,1,0,34,10,1,0,28,16,1,0,22,22,1,0,16,28,1,0,55,15,1,0,44,26,2,0,17,18,2,0,13,22,1,0,80,20,2,0,32,18,2,0,24,26,4,0,9,16,1,0,108,26,2,0,43,24,2,2,15,18,2,2,11,22,2,0,68,18,4,0,27,16,4,0,19,24,4,0,15,28,2,0,78,20,4,0,31,18,2,4,14,18,4,1,13,26,2,0,97,24,2,2,38,22,4,2,18,22,4,2,14,26,2,0,116,30,3,2,36,22,4,4,16,20,4,4,12,24,2,2,68,18,4,1,43,26,6,2,19,24,6,2,15,28,4,0,81,20,1,4,50,30,4,4,22,28,3,8,12,24,2,2,92,24,6,2,36,22,4,6,20,26,7,4,14,28,4,0,107,26,8,1,37,22,8,4,20,24,12,4,11,22,3,1,115,30,4,5,40,24,11,5,16,20,11,5,12,24,5,1,87,22,5,5,41,24,5,7,24,30,11,7,12,24,5,1,98,24,7,3,45,28,15,2,19,24,3,13,15,30,1,5,107,28,10,1,46,28,1,15,22,28,2,17,14,28,5,1,120,30,9,4,43,26,17,1,22,28,2,19,14,28,3,4,113,28,3,11,44,26,17,4,21,26,9,16,13,26,3,5,107,28,3,13,41,26,15,5,24,30,15,10,15,28,4,4,116,28,17,0,42,26,17,6,22,28,19,6,16,30,2,7,111,28,17,0,46,28,7,16,24,30,34,0,13,24,4,5,121,30,4,14,47,28,11,14,24,30,16,14,15,30,6,4,117,30,6,14,45,28,11,16,24,30,30,2,16,30,8,4,106,26,8,13,47,28,7,22,24,30,22,13,15,30,10,2,114,28,19,4,46,28,28,6,22,28,33,4,16,30,8,4,122,30,22,3,45,28,8,26,23,30,12,28,15,30,3,10,117,30,3,23,45,28,4,31,24,30,11,31,15,30,7,7,116,30,21,7,45,28,1,37,23,30,19,26,15,30,5,10,115,30,19,10,47,28,15,25,24,30,23,25,15,30,13,3,115,30,2,29,46,28,42,1,24,30,23,28,15,30,17,0,115,30,10,23,46,28,10,35,24,30,19,35,15,30,17,1,115,30,14,21,46,28,29,19,24,30,11,46,15,30,13,6,115,30,14,23,46,28,44,7,24,30,59,1,16,30,12,7,121,30,12,26,47,28,39,14,24,30,22,41,15,30,6,14,121,30,6,34,47,28,46,10,24,30,2,64,15,30,17,4,122,30,29,14,46,28,49,10,24,30,24,46,15,30,4,18,122,30,13,32,46,28,48,14,24,30,42,32,15,30,20,4,117,30,40,7,47,28,43,22,24,30,10,67,15,30,19,6,118,30,18,31,47,28,34,34,24,30,20,61,15,30],e=[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107],f=[1,2,4,8,16,32,64,128,29,58,116,232,205,135,19,38,76,152,45,90,180,117,234,201,143,3,6,12,24,48,96,192,157,39,78,156,37,74,148,53,106,212,181,119,238,193,159,35,70,140,5,10,20,40,80,160,93,186,105,210,185,111,222,161,95,190,97,194,153,47,94,188,101,202,137,15,30,60,120,240,253,231,211,187,107,214,177,127,254,225,223,163,91,182,113,226,217,175,67,134,17,34,68,136,13,26,52,104,208,189,103,206,129,31,62,124,248,237,199,147,59,118,236,197,151,51,102,204,133,23,46,92,184,109,218,169,79,158,33,66,132,21,42,84,168,77,154,41,82,164,85,170,73,146,57,114,228,213,183,115,230,209,191,99,198,145,63,126,252,229,215,179,123,246,241,255,227,219,171,75,150,49,98,196,149,55,110,220,165,87,174,65,130,25,50,100,200,141,7,14,28,56,112,224,221,167,83,166,81,162,89,178,121,242,249,239,195,155,43,86,172,69,138,9,18,36,72,144,61,122,244,245,247,243,251,235,203,139,11,22,44,88,176,125,250,233,207,131,27,54,108,216,173,71,142,0],g=[255,0,1,25,2,50,26,198,3,223,51,238,27,104,199,75,4,100,224,14,52,141,239,129,28,193,105,248,200,8,76,113,5,138,101,47,225,36,15,33,53,147,142,218,240,18,130,69,29,181,194,125,106,39,249,185,201,154,9,120,77,228,114,166,6,191,139,98,102,221,48,253,226,152,37,179,16,145,34,136,54,208,148,206,143,150,219,189,241,210,19,92,131,56,70,64,30,66,182,163,195,72,126,110,107,58,40,84,250,133,186,61,202,94,155,159,10,21,121,43,78,212,229,172,115,243,167,87,7,112,192,247,140,128,99,13,103,74,222,237,49,197,254,24,227,165,153,119,38,184,180,124,17,68,146,217,35,32,137,46,55,63,209,91,149,188,207,205,144,135,151,178,220,252,190,97,242,86,211,171,20,42,93,158,132,60,57,83,71,109,65,162,31,45,67,216,183,123,164,118,196,23,73,236,127,12,111,246,108,161,59,82,41,157,85,170,251,96,134,177,187,204,62,90,203,89,95,176,156,169,160,81,11,245,22,235,122,117,44,215,79,174,213,233,230,231,173,232,116,214,244,234,168,80,88,175],h=3,i=3,j=40,k=10,l=[3220,1468,2713,1235,3062,1890,2119,1549,2344,2936,1117,2583,1330,2470,1667,2249,2028,3780,481,4011,142,3098,831,3445,592,2517,1776,2234,1951,2827,1070,2660,1345,3177];var m=[],n,o,p,q=[],r=1,s=[],t=[],u,v,w=false,x=[],y=a.qr,z,A,B=[],C,D;var R={VERSION:"1.0.3",canvas:function(a,b){b=G(a,b);return H(function c(){switch(typeof a){case"object":break;case"string":a={value:a};break;default:a={};break}var b,c,d,e,f,g,h=4,i=25;if(a.size>=1&&a.size<=10)h=a.size;h*=i;b=a.canvas||E();c=b.getContext("2d");c.canvas.width=h;c.canvas.height=h;c.fillStyle=a.background||"#fff";c.fillRect(0,0,h,h);if(a.level){switch(a.level.toUpperCase()){case"L":r=1;break;case"M":r=2;break;case"Q":r=3;break;case"H":r=4;break}}g=Q(a.value||"");c.lineWidth=1;f=h;f/=D;f=Math.round(f-.5);c.clearRect(0,0,h,h);c.fillStyle=a.background||"#fff";c.fillRect(0,0,f*(D+8),f*(D+8));c.fillStyle=a.foreground||"#000";for(d=0;d Date: Wed, 25 Sep 2013 14:58:47 +0200 Subject: [PATCH 4/8] Changed QR-Code CSS (selector and attributes) --- inc/shaarli.css | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/inc/shaarli.css b/inc/shaarli.css index 5083984..52a4820 100644 --- a/inc/shaarli.css +++ b/inc/shaarli.css @@ -316,7 +316,8 @@ text-shadow:2px 2px 1px #000000; background: #ffffff; } -div.qrcode { +div#permalinkQrcode { +padding:20px; width:220px; height:220px; background-color: #ffffff; @@ -465,4 +466,4 @@ div.dailyEntryDescription { font-size:10pt; } } /* Highlight search results */ -.highlight { background-color: #FFFF33; } \ No newline at end of file +.highlight { background-color: #FFFF33; } From af77b2fd9a574ba03b309ea0799946fabf37c7d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20SAUVAGE?= Date: Wed, 25 Sep 2013 15:17:09 +0200 Subject: [PATCH 5/8] New QR-Code generation code * QR-Code generation now uses a client-side javascript library instead of an external service. This is better for user privacy. * Library used is http://neocotic.com/qr.js/ (11 kb). * jQuery is no longer used to display QR-Code (this is a first step in removing jQuery entirely). * This library is loaded *only* if the QR-Code icon is clicked. * If javascript is disabled, it will fallback to the external service. * External service was changed from "invx.com" to "qrfree.kaywa.com" because invx has become bloated. By loading the javascript library *only* if the icon is clicked, it will prevent the 11 kb lib to be loaded in every page. --- tpl/linklist.html | 80 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 60 insertions(+), 20 deletions(-) diff --git a/tpl/linklist.html b/tpl/linklist.html index 37ffeb6..bce3fa9 100644 --- a/tpl/linklist.html +++ b/tpl/linklist.html @@ -3,11 +3,11 @@ {include="includes"} {include="page.footer"} +{if="($GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn()) && empty($GLOBALS['disablejquery'])"} + +{/if} \ No newline at end of file diff --git a/tpl/includes.html b/tpl/includes.html index e0ad00d..2b61f1e 100644 --- a/tpl/includes.html +++ b/tpl/includes.html @@ -7,4 +7,3 @@ {if condition="is_file('inc/user.css')"}{/if} -{if="empty($GLOBALS['disablejquery'])"}{/if} diff --git a/tpl/linklist.html b/tpl/linklist.html index bce3fa9..ddc38cb 100644 --- a/tpl/linklist.html +++ b/tpl/linklist.html @@ -68,7 +68,6 @@ {include="page.footer"} {/if} - -{if="($GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn()) && empty($GLOBALS['disablejquery'])"} - -{/if} - -{if="empty($GLOBALS['disablejquery']) && isset($_GET['searchterm'])"} - - -{/if} \ No newline at end of file diff --git a/tpl/picwall.html b/tpl/picwall.html index 631e086..b78e260 100644 --- a/tpl/picwall.html +++ b/tpl/picwall.html @@ -2,7 +2,9 @@ {include="includes"} {if="empty($GLOBALS['disablejquery'])"} - + + + {/if} From 2d20481e45ab598dbe46d0a1cceb56de770b387e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20SAUVAGE?= Date: Thu, 26 Sep 2013 15:17:43 +0200 Subject: [PATCH 7/8] Update README.md --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 8f3c479..cff718c 100644 --- a/README.md +++ b/README.md @@ -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 From 7b2186a63e2c788f1f2622779c5a1c341117eac1 Mon Sep 17 00:00:00 2001 From: Sebastien SAUVAGE Date: Fri, 27 Sep 2013 17:08:31 +0200 Subject: [PATCH 8/8] Corrected field focus in bookmarklet Focus was not properly given to description field when it's empty. --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index 23a6294..0465a4e 100644 --- a/index.php +++ b/index.php @@ -1548,7 +1548,7 @@ function renderPage() $link_is_new = true; // This is a new link $linkdate = strval(date('Ymd_His')); $title = (empty($_GET['title']) ? '' : $_GET['title'] ); // Get title if it was provided in URL (by the bookmarklet). - $description = (empty($_GET['description']) ? '' : $_GET['description'] )."\n"; // Get description if it was provided in URL (by the bookmarklet). [Bronco added that] + $description = (empty($_GET['description']) ? '' : $_GET['description']); // Get description if it was provided in URL (by the bookmarklet). [Bronco added that] $tags = (empty($_GET['tags']) ? '' : $_GET['tags'] ); // Get tags if it was provided in URL $private = (!empty($_GET['private']) && $_GET['private'] === "1" ? 1 : 0); // Get private if it was provided in URL if (($url!='') && parse_url($url,PHP_URL_SCHEME)=='') $url = 'http://'.$url;