Doc: sync from Wiki, generate HTML
Closes #291 Fixes #227 Modifications - HTML content: match the new Wiki structure - Makefile - generate a custom HTML sidebar - include the sidebar on all pages - infer and prepend page titles - handle relative links - add title metadata, e.g. Shaarli - <Page Name> Signed-off-by: VirtualTam <virtualtam@flibidi.net>
This commit is contained in:
parent
96db105e4c
commit
992af0b9d7
61 changed files with 5516 additions and 1213 deletions
36
Makefile
36
Makefile
|
@ -126,8 +126,38 @@ doc: clean
|
|||
@git clone https://github.com/shaarli/Shaarli.wiki.git doc
|
||||
@rm -rf doc/.git
|
||||
|
||||
### Generate a custom sidebar
|
||||
#
|
||||
# Sidebar content:
|
||||
# - convert GitHub-flavoured relative links to standard Markdown
|
||||
# - trim HTML, only keep the list (<ul>[...]</ul>) part
|
||||
htmlsidebar:
|
||||
@echo '<div id="local-sidebar">' > doc/sidebar.html
|
||||
@awk 'BEGIN { FS = "[\\[\\]]{2}" }'\
|
||||
'm = /\[/ { t=$$2; gsub(/ /, "-", $$2); print $$1"["t"]("$$2".html)"$$3 }'\
|
||||
'!m { print $$0 }' doc/_Sidebar.md > doc/tmp.md
|
||||
@pandoc -f markdown -t html5 -s doc/tmp.md | awk '/(ul>|li>)/' >> doc/sidebar.html
|
||||
@echo '</div>' >> doc/sidebar.html
|
||||
@rm doc/tmp.md
|
||||
|
||||
### Convert local markdown documentation to HTML
|
||||
htmldoc:
|
||||
for file in `find doc/ -maxdepth 1 -name "*.md"`; do \
|
||||
pandoc -f markdown_github -t html5 -s -c "github-markdown.css" -o doc/`basename $$file .md`.html "$$file"; \
|
||||
#
|
||||
# For all pages:
|
||||
# - infer title from the file name
|
||||
# - convert GitHub-flavoured relative links to standard Markdown
|
||||
# - insert the sidebar menu
|
||||
htmlpages:
|
||||
@for file in `find doc/ -maxdepth 1 -name "*.md"`; do \
|
||||
base=`basename $$file .md`; \
|
||||
sed -i "1i #$${base//-/ }" $$file; \
|
||||
awk 'BEGIN { FS = "[\\[\\]]{2}" }'\
|
||||
'm = /\[/ { t=$$2; gsub(/ /, "-", $$2); print $$1"["t"]("$$2".html)"$$3 }'\
|
||||
'!m { print $$0 }' $$file > doc/tmp.md; \
|
||||
mv doc/tmp.md $$file; \
|
||||
pandoc -f markdown_github -t html5 -s \
|
||||
-c "github-markdown.css" \
|
||||
-T Shaarli -M pagetitle:"$${base//-/ }" -B doc/sidebar.html \
|
||||
-o doc/$$base.html $$file; \
|
||||
done;
|
||||
|
||||
htmldoc: doc htmlsidebar htmlpages
|
||||
|
|
77
doc/3rd-party-libraries.html
Normal file
77
doc/3rd-party-libraries.html
Normal file
|
@ -0,0 +1,77 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>Shaarli - 3rd party libraries</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="rd-party-libraries">3rd party libraries</h1>
|
||||
<h2 id="css">CSS</h2>
|
||||
<ul>
|
||||
<li>Yahoo UI <a href="http://yuilibrary.com/yui/docs/cssreset/">CSS Reset</a><a href=".html"></a>
|
||||
<ul>
|
||||
<li>resets default CSS properties for all HTML elements (overriding browsers' default values)</li>
|
||||
<li>ensures custom CSS stylessheets will provide the same results on all browsers</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
<h2 id="javascript">Javascript</h2>
|
||||
<ul>
|
||||
<li><a href="https://leaverou.github.io/awesomplete/">Awesomeplete</a> (<a href="https://github.com/LeaVerou/awesomplete">GitHub</a>) - autocompletion in input forms<a href=".html"></a></li>
|
||||
<li><a href="http://dinbror.dk/blazy/">bLazy</a> (<a href="https://github.com/dinbror/blazy">GitHub</a>) - lazy loading for thumbnails<a href=".html"></a></li>
|
||||
<li><a href="http://neocotic.com/qr.js/">qr.js</a> (<a href="https://github.com/neocotic/qr.js">GitHub</a>) - QR code generation<a href=".html"></a></li>
|
||||
</ul>
|
||||
<h2 id="php">PHP</h2>
|
||||
<ul>
|
||||
<li><a href="https://github.com/rainphp/raintpl">RainTPL</a> - HTML templating for PHP<a href=".html"></a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
13
doc/3rd-party-libraries.md
Normal file
13
doc/3rd-party-libraries.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
#3rd party libraries
|
||||
## CSS
|
||||
- Yahoo UI [CSS Reset](http://yuilibrary.com/yui/docs/cssreset/)[](.html)
|
||||
- resets default CSS properties for all HTML elements (overriding browsers' default values)
|
||||
- ensures custom CSS stylessheets will provide the same results on all browsers
|
||||
|
||||
## Javascript
|
||||
- [Awesomeplete](https://leaverou.github.io/awesomplete/) ([GitHub](https://github.com/LeaVerou/awesomplete)) - autocompletion in input forms[](.html)
|
||||
- [bLazy](http://dinbror.dk/blazy/) ([GitHub](https://github.com/dinbror/blazy)) - lazy loading for thumbnails[](.html)
|
||||
- [qr.js](http://neocotic.com/qr.js/) ([GitHub](https://github.com/neocotic/qr.js)) - QR code generation[](.html)
|
||||
|
||||
## PHP
|
||||
- [RainTPL](https://github.com/rainphp/raintpl) - HTML templating for PHP[](.html)
|
102
doc/Backup,-restore,-import-and-export.html
Normal file
102
doc/Backup,-restore,-import-and-export.html
Normal file
|
@ -0,0 +1,102 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>Shaarli - Backup, restore, import and export</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<style type="text/css">
|
||||
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
|
||||
margin: 0; padding: 0; vertical-align: baseline; border: none; }
|
||||
table.sourceCode { width: 100%; line-height: 100%; }
|
||||
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
|
||||
td.sourceCode { padding-left: 5px; }
|
||||
code > span.kw { color: #007020; font-weight: bold; }
|
||||
code > span.dt { color: #902000; }
|
||||
code > span.dv { color: #40a070; }
|
||||
code > span.bn { color: #40a070; }
|
||||
code > span.fl { color: #40a070; }
|
||||
code > span.ch { color: #4070a0; }
|
||||
code > span.st { color: #4070a0; }
|
||||
code > span.co { color: #60a0b0; font-style: italic; }
|
||||
code > span.ot { color: #007020; }
|
||||
code > span.al { color: #ff0000; font-weight: bold; }
|
||||
code > span.fu { color: #06287e; }
|
||||
code > span.er { color: #ff0000; font-weight: bold; }
|
||||
</style>
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="backup-restore-import-and-export">Backup, restore, import and export</h1>
|
||||
<h2 id="backup-and-restore-the-datastore-file">Backup and restore the datastore file</h2>
|
||||
<p>Backup the file <code>data/datastore.php</code> (by FTP or SSH). Restore by putting the file back in place.</p>
|
||||
<p>Example command:</p>
|
||||
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">rsync</span> -avzP my.server.com:/var/www/shaarli/data/datastore.php datastore-<span class="ot">$(</span><span class="kw">date</span> +%Y-%m-%d_%H%M<span class="ot">)</span>.php</code></pre>
|
||||
<h2 id="export-links-as...">Export links as...</h2>
|
||||
<p>To export links as an HTML file, under <em>Tools > Export</em>, choose:</p>
|
||||
<ul>
|
||||
<li><em>Export all</em> to export both public and private links</li>
|
||||
<li><em>Export public</em> to export public links only</li>
|
||||
<li><em>Export private</em> to export private links only</li>
|
||||
</ul>
|
||||
<p>Restore by using the <code>Import</code> feature.</p>
|
||||
<ul>
|
||||
<li>This can be done using the <a href="https://github.com/nodiscc/shaarchiver">shaarchiver</a> tool.<a href=".html"></a></li>
|
||||
</ul>
|
||||
<p>Example command:</p>
|
||||
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">./export-bookmarks.py</span> --url=https://my.server.com/shaarli --username=myusername --password=mysupersecretpassword --download-dir=./ --type=all</code></pre>
|
||||
<h2 id="import-links-from...">Import links from...</h2>
|
||||
<h3 id="diigo">Diigo</h3>
|
||||
<p>If you export your bookmark from Diigo, make sure you use the Delicious export, not the Netscape export. (Their Netscape export is broken, and they don't seem to be interested in fixing it.)</p>
|
||||
<h3 id="mister-wong">Mister Wong</h3>
|
||||
<p>See <a href="https://github.com/sebsauvage/Shaarli/issues/146">this issue</a> for import tweaks.<a href=".html"></a></p>
|
||||
<h3 id="semanticscuttle">SemanticScuttle</h3>
|
||||
<p>To correctly import the tags from a <a href="http://semanticscuttle.sourceforge.net/">SemanticScuttle</a> HTML export, edit the HTML file before importing and replace all occurences of <code>tags=</code> (lowercase) to <code>TAGS=</code> (uppercase).<a href=".html"></a></p>
|
||||
</body>
|
||||
</html>
|
35
doc/Backup,-restore,-import-and-export.md
Normal file
35
doc/Backup,-restore,-import-and-export.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
#Backup, restore, import and export
|
||||
## Backup and restore the datastore file
|
||||
|
||||
Backup the file `data/datastore.php` (by FTP or SSH). Restore by putting the file back in place.
|
||||
|
||||
Example command:
|
||||
```bash
|
||||
rsync -avzP my.server.com:/var/www/shaarli/data/datastore.php datastore-$(date +%Y-%m-%d_%H%M).php
|
||||
```
|
||||
|
||||
## Export links as...
|
||||
To export links as an HTML file, under _Tools > Export_, choose:
|
||||
- _Export all_ to export both public and private links
|
||||
- _Export public_ to export public links only
|
||||
- _Export private_ to export private links only
|
||||
|
||||
Restore by using the `Import` feature.
|
||||
* This can be done using the [shaarchiver](https://github.com/nodiscc/shaarchiver) tool.[](.html)
|
||||
|
||||
Example command:
|
||||
```bash
|
||||
./export-bookmarks.py --url=https://my.server.com/shaarli --username=myusername --password=mysupersecretpassword --download-dir=./ --type=all
|
||||
```
|
||||
|
||||
## Import links from...
|
||||
### Diigo
|
||||
|
||||
If you export your bookmark from Diigo, make sure you use the Delicious export, not the Netscape export. (Their Netscape export is broken, and they don't seem to be interested in fixing it.)
|
||||
|
||||
### Mister Wong
|
||||
See [this issue](https://github.com/sebsauvage/Shaarli/issues/146) for import tweaks.[](.html)
|
||||
|
||||
### SemanticScuttle
|
||||
|
||||
To correctly import the tags from a [SemanticScuttle](http://semanticscuttle.sourceforge.net/) HTML export, edit the HTML file before importing and replace all occurences of `tags=` (lowercase) to `TAGS=` (uppercase).[](.html)
|
65
doc/Coding-guidelines.html
Normal file
65
doc/Coding-guidelines.html
Normal file
|
@ -0,0 +1,65 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>Shaarli - Coding guidelines</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="coding-guidelines">Coding guidelines</h1>
|
||||
<h2 id="wip">WIP</h2>
|
||||
<p>This topic is currently being discussed here:</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/shaarli/Shaarli/issues/95">Fix coding style (static analysis)</a> (#95)<a href=".html"></a></li>
|
||||
<li><a href="https://github.com/shaarli/Shaarli/issues/130">Continuous Integration tools & features</a> (#130)<a href=".html"></a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
5
doc/Coding-guidelines.md
Normal file
5
doc/Coding-guidelines.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
#Coding guidelines
|
||||
## WIP
|
||||
This topic is currently being discussed here:
|
||||
- [Fix coding style (static analysis)](https://github.com/shaarli/Shaarli/issues/95) (#95)[](.html)
|
||||
- [Continuous Integration tools & features](https://github.com/shaarli/Shaarli/issues/130) (#130)[](.html)
|
101
doc/Community-&-Related-software.html
Normal file
101
doc/Community-&-Related-software.html
Normal file
|
@ -0,0 +1,101 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>Shaarli - Community & Related software</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="community-related-software">Community & Related software</h1>
|
||||
<p><em>Unofficial but related work on Shaarli. If you maintain one of these, please get in touch with us to help us find a way to adapt your work to our fork.</em></p>
|
||||
<p><em>TODO: contact repos owners to see if they'd like to standardize their work with the community fork.</em></p>
|
||||
<h2 id="community">Community</h2>
|
||||
<ul>
|
||||
<li><a href="http://sebsauvage.net/links/">Liens en vrac de sebsauvage</a> - the original Shaarli<a href=".html"></a></li>
|
||||
<li><a href="http://porneia.free.fr/pub/links/ou-est-shaarli.html">A large list of Shaarlis</a><a href=".html"></a></li>
|
||||
<li><a href="https://raw.githubusercontent.com/Oros42/find_shaarlis/master/annuaires.json">A list of working Shaarli aggregators</a><a href=".html"></a></li>
|
||||
<li><a href="https://github.com/Oros42/shaarlis_list">A list of some known Shaarlis</a><a href=".html"></a></li>
|
||||
<li><a href="http://sebsauvage.net/rhaa/index.php?2011/09/16/09/29/58-adieu-delicious-diigo-et-stumbleupon-salut-shaarli-">Adieu Delicious, Diigo et StumbleUpon. Salut Shaarli ! - sebsauvage.net</a> (fr) <em>16/09/2011 - the original post about Shaarli</em><a href=".html"></a></li>
|
||||
<li><a href="http://sebsauvage.net/wiki/doku.php?id=php:shaarli:ideas">Original ideas/fixme/TODO page</a><a href=".html"></a></li>
|
||||
<li><a href="http://sebsauvage.net/wiki/doku.php?id=php:shaarli:discussion">Original discussion page</a> (fr)<a href=".html"></a></li>
|
||||
<li><a href="http://sebsauvage.net/wiki/doku.php?id=php:shaarli:history">Original revisions history</a><a href=".html"></a></li>
|
||||
<li><a href="https://www.shaarli.fr/my.php">Shaarli.fr/my</a> - Unofficial, unsupported (old fork) hosted Shaarlis provider, courtesy of <a href="https://github.com/DMeloni">DMeloni</a><a href=".html"></a></li>
|
||||
<li><a href="http://shaarferme.etudiant-libre.fr.nf/index.php">Shaarli Community</a> - Unknown Shaarli hoster (unsupported, old fork)<a href=".html"></a></li>
|
||||
</ul>
|
||||
<h3 id="themes">Themes</h3>
|
||||
<p>See <a href="Theming.html">Theming</a> for the list of community-contributed themes, and an installation guide.</p>
|
||||
<h3 id="server-apps">Server apps</h3>
|
||||
<ul>
|
||||
<li><a href="https://github.com/nodiscc/shaarchiver">shaarchiver</a> - Archive your Shaarli bookmarks and their content<a href=".html"></a></li>
|
||||
<li><a href="https://github.com/mknexen/shaarli-river">shaarli-river</a> - An aggregator for shaarlis with many features <a href=".html"></a></li>
|
||||
<li><a href="https://github.com/DMeloni/shaarlo">Shaarlo</a> - An aggregator for shaarlis with many features (a very popular running instance among french shaarliers: <a href="http://shaarli.fr/">shaarli.fr</a>)<a href=".html"></a></li>
|
||||
<li><a href="https://github.com/BoboTiG/shaarlimages">Shaarlimages</a> - An image-oriented aggregator for Shaarlis<a href=".html"></a></li>
|
||||
<li><a href="https://github.com/mknexen/shaarli-api">mknexen/shaarli-api</a> - A REST API for Shaarli<a href=".html"></a></li>
|
||||
<li><a href="https://github.com/qwertygc/shaarli-dev-code/blob/master/self-dead-link.php">Self dead link</a> - Detect dead links on shaarli. This version use the database of shaarli. An <a href="https://github.com/qwertygc/shaarli-dev-code/blob/master/dead-link.php">another version</a>, can be used for others shaarli (but use most ressources).<a href=".html"></a></li>
|
||||
</ul>
|
||||
<h3 id="android-apps">Android apps</h3>
|
||||
<ul>
|
||||
<li><a href="http://sebsauvage.net/links/?ZAyDzg">Shaarli for Android</a> - Android application that adds Shaarli as a sharing provider<a href=".html"></a></li>
|
||||
<li><a href="https://github.com/dimtion/Shaarlier">Shaarlier for Android</a> - Android application to simply add links directly into your Shaarli<a href=".html"></a></li>
|
||||
</ul>
|
||||
<h2 id="integration-with-other-platforms">Integration with other platforms</h2>
|
||||
<ul>
|
||||
<li><a href="https://github.com/jcsaaddupuy/tt-rss-shaarli">tt-rss-shaarli</a> - <a href="http://tt-rss.org/">TinyTiny RSS</a> plugin that adds support for sharing articles with Shaarli<a href=".html"></a></li>
|
||||
<li><a href="https://github.com/ahmet2mir/octopress-shaarli">octopress-shaarli</a> - Octopress plugin to retrieve Shaarli links on the sidebara<a href=".html"></a></li>
|
||||
</ul>
|
||||
<h2 id="alternatives-to-shaarli">Alternatives to Shaarli</h2>
|
||||
<ul>
|
||||
<li><a href="http://alternativeto.net/software/shaarli/">Shaarli alternatives</a> (alternativeto.net)<a href=".html"></a></li>
|
||||
<li><a href="https://github.com/bookieio/bookie">Bookie</a> - Another self-hostable, free bookmark sharing software, written in Python<a href=".html"></a></li>
|
||||
<li><a href="https://github.com/plainmade/unmark">Unmark</a> - An open source todo app for bookmarks (<a href="https://unmark.it/">Homepage</a>)<a href=".html"></a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
40
doc/Community-&-Related-software.md
Normal file
40
doc/Community-&-Related-software.md
Normal file
|
@ -0,0 +1,40 @@
|
|||
#Community & Related software
|
||||
*Unofficial but related work on Shaarli. If you maintain one of these, please get in touch with us to help us find a way to adapt your work to our fork.*
|
||||
|
||||
*TODO: contact repos owners to see if they'd like to standardize their work with the community fork.*
|
||||
|
||||
## Community
|
||||
* [Liens en vrac de sebsauvage](http://sebsauvage.net/links/) - the original Shaarli[](.html)
|
||||
* [A large list of Shaarlis](http://porneia.free.fr/pub/links/ou-est-shaarli.html)[](.html)
|
||||
* [A list of working Shaarli aggregators](https://raw.githubusercontent.com/Oros42/find_shaarlis/master/annuaires.json)[](.html)
|
||||
* [A list of some known Shaarlis](https://github.com/Oros42/shaarlis_list)[](.html)
|
||||
* [Adieu Delicious, Diigo et StumbleUpon. Salut Shaarli ! - sebsauvage.net](http://sebsauvage.net/rhaa/index.php?2011/09/16/09/29/58-adieu-delicious-diigo-et-stumbleupon-salut-shaarli-) (fr) _16/09/2011 - the original post about Shaarli_[](.html)
|
||||
* [Original ideas/fixme/TODO page](http://sebsauvage.net/wiki/doku.php?id=php:shaarli:ideas)[](.html)
|
||||
* [Original discussion page](http://sebsauvage.net/wiki/doku.php?id=php:shaarli:discussion) (fr)[](.html)
|
||||
* [Original revisions history](http://sebsauvage.net/wiki/doku.php?id=php:shaarli:history)[](.html)
|
||||
* [Shaarli.fr/my](https://www.shaarli.fr/my.php) - Unofficial, unsupported (old fork) hosted Shaarlis provider, courtesy of [DMeloni](https://github.com/DMeloni)[](.html)
|
||||
* [Shaarli Community](http://shaarferme.etudiant-libre.fr.nf/index.php) - Unknown Shaarli hoster (unsupported, old fork)[](.html)
|
||||
|
||||
### Themes
|
||||
See [Theming](Theming.html) for the list of community-contributed themes, and an installation guide.
|
||||
|
||||
### Server apps
|
||||
* [shaarchiver](https://github.com/nodiscc/shaarchiver) - Archive your Shaarli bookmarks and their content[](.html)
|
||||
* [shaarli-river](https://github.com/mknexen/shaarli-river) - An aggregator for shaarlis with many features [](.html)
|
||||
* [Shaarlo](https://github.com/DMeloni/shaarlo) - An aggregator for shaarlis with many features (a very popular running instance among french shaarliers: [shaarli.fr](http://shaarli.fr/))[](.html)
|
||||
* [Shaarlimages](https://github.com/BoboTiG/shaarlimages) - An image-oriented aggregator for Shaarlis[](.html)
|
||||
* [mknexen/shaarli-api](https://github.com/mknexen/shaarli-api) - A REST API for Shaarli[](.html)
|
||||
* [Self dead link](https://github.com/qwertygc/shaarli-dev-code/blob/master/self-dead-link.php) - Detect dead links on shaarli. This version use the database of shaarli. An [another version](https://github.com/qwertygc/shaarli-dev-code/blob/master/dead-link.php), can be used for others shaarli (but use most ressources).[](.html)
|
||||
|
||||
### Android apps
|
||||
* [Shaarli for Android](http://sebsauvage.net/links/?ZAyDzg) - Android application that adds Shaarli as a sharing provider[](.html)
|
||||
* [Shaarlier for Android](https://github.com/dimtion/Shaarlier) - Android application to simply add links directly into your Shaarli[](.html)
|
||||
|
||||
## Integration with other platforms
|
||||
* [tt-rss-shaarli](https://github.com/jcsaaddupuy/tt-rss-shaarli) - [TinyTiny RSS](http://tt-rss.org/) plugin that adds support for sharing articles with Shaarli[](.html)
|
||||
* [octopress-shaarli](https://github.com/ahmet2mir/octopress-shaarli) - Octopress plugin to retrieve Shaarli links on the sidebara[](.html)
|
||||
|
||||
## Alternatives to Shaarli
|
||||
* [Shaarli alternatives](http://alternativeto.net/software/shaarli/) (alternativeto.net)[](.html)
|
||||
* [Bookie](https://github.com/bookieio/bookie) - Another self-hostable, free bookmark sharing software, written in Python[](.html)
|
||||
* [Unmark](https://github.com/plainmade/unmark) - An open source todo app for bookmarks ([Homepage](https://unmark.it/))[](.html)
|
|
@ -1,75 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title></title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<p>Example bash script:</p>
|
||||
<pre><code>#!/bin/bash
|
||||
#Description: Copy a Shaarli installation over SSH/SCP, serve it locally with php-cli
|
||||
#Will create a local-shaarli/ directory when you run it, backup your Shaarli there, and serve it locally.
|
||||
#Will NOT download linked pages. It's just a directly usable backup/copy/mirror of your Shaarli
|
||||
#Requires: ssh, scp and a working SSH access to the server where your Shaarli is installed
|
||||
#Usage: ./local-shaarli.sh
|
||||
#Author: nodiscc (nodiscc@gmail.com)
|
||||
#License: MIT (http://opensource.org/licenses/MIT)
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
|
||||
##### CONFIG #################
|
||||
#The port used by php's local server
|
||||
php_local_port=7431
|
||||
|
||||
#Name of the SSH server and path where Shaarli is installed
|
||||
#TODO: pass these as command-line arguments
|
||||
remotehost="my.ssh.server"
|
||||
remote_shaarli_dir="/var/www/shaarli"
|
||||
|
||||
|
||||
###### FUNCTIONS #############
|
||||
_main() {
|
||||
_CBSyncShaarli
|
||||
_CBServeShaarli
|
||||
}
|
||||
|
||||
_CBSyncShaarli() {
|
||||
remote_temp_dir=$(ssh $remotehost mktemp -d)
|
||||
remote_ssh_user=$(ssh $remotehost whoami)
|
||||
ssh -t "$remotehost" sudo cp -r "$remote_shaarli_dir" "$remote_temp_dir"
|
||||
ssh -t "$remotehost" sudo chown -R "$remote_ssh_user":"$remote_ssh_user" "$remote_temp_dir"
|
||||
scp -rq "$remotehost":"$remote_temp_dir" local-shaarli
|
||||
ssh "$remotehost" rm -r "$remote_temp_dir"
|
||||
}
|
||||
|
||||
_CBServeShaarli() {
|
||||
#TODO: allow serving a previously downloaded Shaarli
|
||||
#TODO: ask before overwriting local copy, if it exists
|
||||
cd local-shaarli/
|
||||
php -S localhost:${php_local_port}
|
||||
echo "Please go to http://localhost:${php_local_port}"
|
||||
}
|
||||
|
||||
|
||||
##### MAIN #################
|
||||
|
||||
_main</code></pre>
|
||||
<p>This outputs:</p>
|
||||
<pre><code>$ ./local-shaarli.sh
|
||||
PHP 5.6.0RC4 Development Server started at Mon Sep 1 21:56:19 2014
|
||||
Listening on http://localhost:7431
|
||||
Document root is /home/user/local-shaarli/shaarli
|
||||
Press Ctrl-C to quit.
|
||||
|
||||
[Mon Sep 1 21:56:27 2014] ::1:57868 [200]: /
|
||||
[Mon Sep 1 21:56:27 2014] ::1:57869 [200]: /index.html
|
||||
[Mon Sep 1 21:56:37 2014] ::1:57881 [200]: /...</code></pre>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,137 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>Shaarli - Copy an existing installation over SSH and serve it locally</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<style type="text/css">
|
||||
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
|
||||
margin: 0; padding: 0; vertical-align: baseline; border: none; }
|
||||
table.sourceCode { width: 100%; line-height: 100%; }
|
||||
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
|
||||
td.sourceCode { padding-left: 5px; }
|
||||
code > span.kw { color: #007020; font-weight: bold; }
|
||||
code > span.dt { color: #902000; }
|
||||
code > span.dv { color: #40a070; }
|
||||
code > span.bn { color: #40a070; }
|
||||
code > span.fl { color: #40a070; }
|
||||
code > span.ch { color: #4070a0; }
|
||||
code > span.st { color: #4070a0; }
|
||||
code > span.co { color: #60a0b0; font-style: italic; }
|
||||
code > span.ot { color: #007020; }
|
||||
code > span.al { color: #ff0000; font-weight: bold; }
|
||||
code > span.fu { color: #06287e; }
|
||||
code > span.er { color: #ff0000; font-weight: bold; }
|
||||
</style>
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="copy-an-existing-installation-over-ssh-and-serve-it-locally">Copy an existing installation over SSH and serve it locally</h1>
|
||||
<p>Example bash script:</p>
|
||||
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="co">#!/bin/bash</span>
|
||||
<span class="co">#Description: Copy a Shaarli installation over SSH/SCP, serve it locally with php-cli</span>
|
||||
<span class="co">#Will create a local-shaarli/ directory when you run it, backup your Shaarli there, and serve it locally.</span>
|
||||
<span class="co">#Will NOT download linked pages. It's just a directly usable backup/copy/mirror of your Shaarli</span>
|
||||
<span class="co">#Requires: ssh, scp and a working SSH access to the server where your Shaarli is installed</span>
|
||||
<span class="co">#Usage: ./local-shaarli.sh</span>
|
||||
<span class="co">#Author: nodiscc (nodiscc@gmail.com)</span>
|
||||
<span class="co">#License: MIT (http://opensource.org/licenses/MIT)</span>
|
||||
<span class="kw">set</span> <span class="kw">-o</span> errexit
|
||||
<span class="kw">set</span> <span class="kw">-o</span> nounset
|
||||
|
||||
<span class="co">##### CONFIG #################</span>
|
||||
<span class="co">#The port used by php's local server</span>
|
||||
<span class="ot">php_local_port=</span>7431
|
||||
|
||||
<span class="co">#Name of the SSH server and path where Shaarli is installed</span>
|
||||
<span class="co">#TODO: pass these as command-line arguments</span>
|
||||
<span class="ot">remotehost=</span><span class="st">"my.ssh.server"</span>
|
||||
<span class="ot">remote_shaarli_dir=</span><span class="st">"/var/www/shaarli"</span>
|
||||
|
||||
|
||||
<span class="co">###### FUNCTIONS #############</span>
|
||||
<span class="fu">_main()</span> <span class="kw">{</span>
|
||||
<span class="kw">_CBSyncShaarli</span>
|
||||
<span class="kw">_CBServeShaarli</span>
|
||||
<span class="kw">}</span>
|
||||
|
||||
<span class="fu">_CBSyncShaarli()</span> <span class="kw">{</span>
|
||||
<span class="ot">remote_temp_dir=$(</span><span class="kw">ssh</span> <span class="ot">$remotehost</span> mktemp -d<span class="ot">)</span>
|
||||
<span class="ot">remote_ssh_user=$(</span><span class="kw">ssh</span> <span class="ot">$remotehost</span> whoami<span class="ot">)</span>
|
||||
<span class="kw">ssh</span> -t <span class="st">"</span><span class="ot">$remotehost</span><span class="st">"</span> sudo cp -r <span class="st">"</span><span class="ot">$remote_shaarli_dir</span><span class="st">"</span> <span class="st">"</span><span class="ot">$remote_temp_dir</span><span class="st">"</span>
|
||||
<span class="kw">ssh</span> -t <span class="st">"</span><span class="ot">$remotehost</span><span class="st">"</span> sudo chown -R <span class="st">"</span><span class="ot">$remote_ssh_user</span><span class="st">"</span>:<span class="st">"</span><span class="ot">$remote_ssh_user</span><span class="st">"</span> <span class="st">"</span><span class="ot">$remote_temp_dir</span><span class="st">"</span>
|
||||
<span class="kw">scp</span> -rq <span class="st">"</span><span class="ot">$remotehost</span><span class="st">"</span>:<span class="st">"</span><span class="ot">$remote_temp_dir</span><span class="st">"</span> local-shaarli
|
||||
<span class="kw">ssh</span> <span class="st">"</span><span class="ot">$remotehost</span><span class="st">"</span> rm -r <span class="st">"</span><span class="ot">$remote_temp_dir</span><span class="st">"</span>
|
||||
<span class="kw">}</span>
|
||||
|
||||
<span class="fu">_CBServeShaarli()</span> <span class="kw">{</span>
|
||||
<span class="co">#TODO: allow serving a previously downloaded Shaarli</span>
|
||||
<span class="co">#TODO: ask before overwriting local copy, if it exists</span>
|
||||
<span class="kw">cd</span> local-shaarli/
|
||||
<span class="kw">php</span> -S localhost:<span class="ot">${php_local_port}</span>
|
||||
<span class="kw">echo</span> <span class="st">"Please go to http://localhost:</span><span class="ot">${php_local_port}</span><span class="st">"</span>
|
||||
<span class="kw">}</span>
|
||||
|
||||
|
||||
<span class="co">##### MAIN #################</span>
|
||||
|
||||
<span class="kw">_main</span></code></pre>
|
||||
<p>This outputs:</p>
|
||||
<pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="kw">./local-shaarli.sh</span>
|
||||
<span class="kw">PHP</span> 5.6.0RC4 Development Server started at Mon Sep 1 21:56:19 2014
|
||||
<span class="kw">Listening</span> on http://localhost:7431
|
||||
<span class="kw">Document</span> root is /home/user/local-shaarli/shaarli
|
||||
<span class="kw">Press</span> Ctrl-C to quit.
|
||||
|
||||
[<span class="kw">Mon</span> Sep 1 21:56:27 2014] ::1:57868 [200]: /[](.html)
|
||||
[<span class="kw">Mon</span> Sep 1 21:56:27 2014] ::1:57869 [200]: /index.html[](.html)
|
||||
[<span class="kw">Mon</span> Sep 1 21:56:37 2014] ::1:57881 [200]: /...[](.html)</code></pre>
|
||||
</body>
|
||||
</html>
|
|
@ -1,6 +1,7 @@
|
|||
#Copy an existing installation over SSH and serve it locally
|
||||
Example bash script:
|
||||
|
||||
```
|
||||
```bash
|
||||
#!/bin/bash
|
||||
#Description: Copy a Shaarli installation over SSH/SCP, serve it locally with php-cli
|
||||
#Will create a local-shaarli/ directory when you run it, backup your Shaarli there, and serve it locally.
|
||||
|
@ -53,14 +54,14 @@ _main
|
|||
|
||||
This outputs:
|
||||
|
||||
```
|
||||
```bash
|
||||
$ ./local-shaarli.sh
|
||||
PHP 5.6.0RC4 Development Server started at Mon Sep 1 21:56:19 2014
|
||||
Listening on http://localhost:7431
|
||||
Document root is /home/user/local-shaarli/shaarli
|
||||
Press Ctrl-C to quit.
|
||||
|
||||
[Mon Sep 1 21:56:27 2014] ::1:57868 [200]: /
|
||||
[Mon Sep 1 21:56:27 2014] ::1:57869 [200]: /index.html
|
||||
[Mon Sep 1 21:56:37 2014] ::1:57881 [200]: /...
|
||||
```
|
||||
[Mon Sep 1 21:56:27 2014] ::1:57868 [200]: /[](.html)
|
||||
[Mon Sep 1 21:56:27 2014] ::1:57869 [200]: /index.html[](.html)
|
||||
[Mon Sep 1 21:56:37 2014] ::1:57881 [200]: /...[](.html)
|
||||
```
|
94
doc/Datastore-hacks.html
Normal file
94
doc/Datastore-hacks.html
Normal file
|
@ -0,0 +1,94 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>Shaarli - Datastore hacks</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<style type="text/css">
|
||||
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
|
||||
margin: 0; padding: 0; vertical-align: baseline; border: none; }
|
||||
table.sourceCode { width: 100%; line-height: 100%; }
|
||||
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
|
||||
td.sourceCode { padding-left: 5px; }
|
||||
code > span.kw { color: #007020; font-weight: bold; }
|
||||
code > span.dt { color: #902000; }
|
||||
code > span.dv { color: #40a070; }
|
||||
code > span.bn { color: #40a070; }
|
||||
code > span.fl { color: #40a070; }
|
||||
code > span.ch { color: #4070a0; }
|
||||
code > span.st { color: #4070a0; }
|
||||
code > span.co { color: #60a0b0; font-style: italic; }
|
||||
code > span.ot { color: #007020; }
|
||||
code > span.al { color: #ff0000; font-weight: bold; }
|
||||
code > span.fu { color: #06287e; }
|
||||
code > span.er { color: #ff0000; font-weight: bold; }
|
||||
</style>
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="datastore-hacks">Datastore hacks</h1>
|
||||
<h3 id="decode-datastore-content">Decode datastore content</h3>
|
||||
<p>To display the array representing the data saved in <code>data/datastore.php</code>, use the following snippet:</p>
|
||||
<pre class="sourceCode php"><code class="sourceCode php"><span class="kw">$data</span> = <span class="st">"tZNdb9MwFIb... <Commented content inside datastore.php>"</span><span class="ot">;</span>
|
||||
<span class="kw">$out</span> = <span class="fu">unserialize</span><span class="ot">(</span><span class="fu">gzinflate</span><span class="ot">(</span><span class="fu">base64_decode</span><span class="ot">(</span><span class="kw">$data</span><span class="ot">)));</span>
|
||||
<span class="fu">echo</span> <span class="st">"<pre>"</span><span class="ot">;</span> <span class="co">// Pretty printing is love, pretty printing is life</span>
|
||||
<span class="fu">print_r</span><span class="ot">(</span><span class="kw">$out</span><span class="ot">);</span>
|
||||
<span class="fu">echo</span> <span class="st">"</pre>"</span><span class="ot">;</span>
|
||||
<span class="fu">exit</span><span class="ot">;</span></code></pre>
|
||||
<p>This will output the internal representation of the datastore, "unobfuscated" (if this can really be considered obfuscation).</p>
|
||||
<h3 id="changing-the-timestamp-for-a-link">Changing the timestamp for a link</h3>
|
||||
<ul>
|
||||
<li>Look for <code><input type="hidden" name="lf_linkdate" value="{$link.linkdate}"></code> in <code>tpl/editlink.tpl</code> (line 14)</li>
|
||||
<li>Remove <code>type="hidden"</code> from this line</li>
|
||||
<li>A new date/time field becomes available in the edit/new link dialog.</li>
|
||||
<li>You can set the timestamp manually by entering it in the format <code>YYYMMDD_HHMMS</code>.</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
19
doc/Datastore-hacks.md
Normal file
19
doc/Datastore-hacks.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
#Datastore hacks
|
||||
### Decode datastore content
|
||||
To display the array representing the data saved in `data/datastore.php`, use the following snippet:
|
||||
|
||||
```php
|
||||
$data = "tZNdb9MwFIb... <Commented content inside datastore.php>";
|
||||
$out = unserialize(gzinflate(base64_decode($data)));
|
||||
echo "<pre>"; // Pretty printing is love, pretty printing is life
|
||||
print_r($out);
|
||||
echo "</pre>";
|
||||
exit;
|
||||
```
|
||||
This will output the internal representation of the datastore, "unobfuscated" (if this can really be considered obfuscation).
|
||||
|
||||
### Changing the timestamp for a link
|
||||
* Look for `<input type="hidden" name="lf_linkdate" value="{$link.linkdate}">` in `tpl/editlink.tpl` (line 14)
|
||||
* Remove `type="hidden"` from this line
|
||||
* A new date/time field becomes available in the edit/new link dialog.
|
||||
* You can set the timestamp manually by entering it in the format `YYYMMDD_HHMMS`.
|
102
doc/Development.html
Normal file
102
doc/Development.html
Normal file
|
@ -0,0 +1,102 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>Shaarli - Development</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="development">Development</h1>
|
||||
<h2 id="guidelines">Guidelines</h2>
|
||||
<p>Please have a look at the following pages:</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/shaarli/Shaarli/tree/master/CONTRIBUTING.md">Contributing to Shaarli</a><a href=".html"></a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a> - patches should try to stick to the <a href="http://www.php-fig.org/psr/">PHP Standard Recommendations</a> (PSR), especially:
|
||||
<ul>
|
||||
<li><a href="http://www.php-fig.org/psr/psr-1/">PSR-1</a> - Basic Coding Standard<a href=".html"></a></li>
|
||||
<li><a href="http://www.php-fig.org/psr/psr-2/">PSR-2</a> - Coding Style Guide<a href=".html"></a></li>
|
||||
</ul></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a> for tags/releases</li>
|
||||
</ul>
|
||||
<h2 id="continuous-integration-tools">Continuous integration tools</h2>
|
||||
<h3 id="local-development">Local development</h3>
|
||||
<p>A <a href="https://github.com/shaarli/Shaarli/blob/master/Makefile"><code>Makefile</code></a> is available to perform project-related operations:<a href=".html"></a></p>
|
||||
<ul>
|
||||
<li>Documentation - generate a local HTML copy of the GitHub wiki</li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a> - check that the code is compliant to PHP conventions</li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a> - ensure there are no regressions introduced by new commits</li>
|
||||
</ul>
|
||||
<h3 id="automatic-builds">Automatic builds</h3>
|
||||
<p><a href="http://docs.travis-ci.com/">Travis CI</a> is a Continuous Integration build server, that runs a build:<a href=".html"></a></p>
|
||||
<ul>
|
||||
<li>each time a commit is merged to the mainline (<code>master</code> branch)</li>
|
||||
<li>each time a Pull Request is submitted or updated</li>
|
||||
</ul>
|
||||
<p>A build is composed of several jobs: one for each supported PHP version (see <a href="Server-requirements.html">Server requirements</a>).</p>
|
||||
<p>Each build job:</p>
|
||||
<ul>
|
||||
<li>updates Composer</li>
|
||||
<li>installs 3rd-party test dependencies with Composer</li>
|
||||
<li>runs <a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul>
|
||||
<p>After all jobs have finished, Travis returns the results to GitHub:</p>
|
||||
<ul>
|
||||
<li>a status icon represents the result for the <code>master</code> branch: <a href="(https://api.travis-ci.org/shaarli/Shaarli.svg)](https://travis-ci.org/shaarli/Shaarli).html"><img src="https://travis-ci.org/shaarli/Shaarli" alt="(https://api.travis-ci.org/shaarli/Shaarli.svg)" /></a></li>
|
||||
<li>Pull Requests are updated with the Travis result
|
||||
<ul>
|
||||
<li>Green: all tests have passed</li>
|
||||
<li>Red: some tests failed</li>
|
||||
<li>Orange: tests are pending</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
35
doc/Development.md
Normal file
35
doc/Development.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
#Development
|
||||
## Guidelines
|
||||
Please have a look at the following pages:
|
||||
- [Contributing to Shaarli](https://github.com/shaarli/Shaarli/tree/master/CONTRIBUTING.md)[](.html)
|
||||
- [Static analysis](Static-analysis.html) - patches should try to stick to the [PHP Standard Recommendations](http://www.php-fig.org/psr/) (PSR), especially:
|
||||
- [PSR-1](http://www.php-fig.org/psr/psr-1/) - Basic Coding Standard[](.html)
|
||||
- [PSR-2](http://www.php-fig.org/psr/psr-2/) - Coding Style Guide[](.html)
|
||||
- [Unit tests](Unit-tests.html)
|
||||
- [GnuPG signature](GnuPG-signature.html) for tags/releases
|
||||
|
||||
## Continuous integration tools
|
||||
### Local development
|
||||
A [`Makefile`](https://github.com/shaarli/Shaarli/blob/master/Makefile) is available to perform project-related operations:[](.html)
|
||||
- Documentation - generate a local HTML copy of the GitHub wiki
|
||||
- [Static analysis](Static-analysis.html) - check that the code is compliant to PHP conventions
|
||||
- [Unit tests](Unit-tests.html) - ensure there are no regressions introduced by new commits
|
||||
|
||||
### Automatic builds
|
||||
[Travis CI](http://docs.travis-ci.com/) is a Continuous Integration build server, that runs a build:[](.html)
|
||||
- each time a commit is merged to the mainline (`master` branch)
|
||||
- each time a Pull Request is submitted or updated
|
||||
|
||||
A build is composed of several jobs: one for each supported PHP version (see [Server requirements](Server-requirements.html)).
|
||||
|
||||
Each build job:
|
||||
- updates Composer
|
||||
- installs 3rd-party test dependencies with Composer
|
||||
- runs [Unit tests](Unit-tests.html)
|
||||
|
||||
After all jobs have finished, Travis returns the results to GitHub:
|
||||
- a status icon represents the result for the `master` branch: [![(https://api.travis-ci.org/shaarli/Shaarli.svg)](https://travis-ci.org/shaarli/Shaarli)]((https://api.travis-ci.org/shaarli/Shaarli.svg)](https://travis-ci.org/shaarli/Shaarli).html)
|
||||
- Pull Requests are updated with the Travis result
|
||||
- Green: all tests have passed
|
||||
- Red: some tests failed
|
||||
- Orange: tests are pending
|
107
doc/Directory-structure.html
Normal file
107
doc/Directory-structure.html
Normal file
|
@ -0,0 +1,107 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>Shaarli - Directory structure</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<style type="text/css">
|
||||
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
|
||||
margin: 0; padding: 0; vertical-align: baseline; border: none; }
|
||||
table.sourceCode { width: 100%; line-height: 100%; }
|
||||
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
|
||||
td.sourceCode { padding-left: 5px; }
|
||||
code > span.kw { color: #007020; font-weight: bold; }
|
||||
code > span.dt { color: #902000; }
|
||||
code > span.dv { color: #40a070; }
|
||||
code > span.bn { color: #40a070; }
|
||||
code > span.fl { color: #40a070; }
|
||||
code > span.ch { color: #4070a0; }
|
||||
code > span.st { color: #4070a0; }
|
||||
code > span.co { color: #60a0b0; font-style: italic; }
|
||||
code > span.ot { color: #007020; }
|
||||
code > span.al { color: #ff0000; font-weight: bold; }
|
||||
code > span.fu { color: #06287e; }
|
||||
code > span.er { color: #ff0000; font-weight: bold; }
|
||||
</style>
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="directory-structure">Directory structure</h1>
|
||||
<p>Here is the directory structure of Shaarli and the purpose of the different files:</p>
|
||||
<pre class="sourceCode bash"><code class="sourceCode bash"> <span class="kw">index.php</span> <span class="co"># Main program</span>
|
||||
<span class="kw">application/</span> <span class="co"># Shaarli classes</span>
|
||||
├── <span class="kw">LinkDB.php</span>
|
||||
└── <span class="kw">Utils.php</span>
|
||||
<span class="kw">tests/</span> <span class="co"># Shaarli unitary & functional tests</span>
|
||||
├── <span class="kw">LinkDBTest.php</span>
|
||||
├── <span class="kw">utils</span> <span class="co"># utilities to ease testing</span>
|
||||
│ └── <span class="kw">ReferenceLinkDB.php</span>
|
||||
└── <span class="kw">UtilsTest.php</span>
|
||||
<span class="kw">COPYING</span> <span class="co"># Shaarli license</span>
|
||||
<span class="kw">inc/</span> <span class="co"># static assets and 3rd party libraries</span>
|
||||
├── <span class="kw">awesomplete.*</span> <span class="co"># tags autocompletion library</span>
|
||||
├── <span class="kw">blazy.*</span> <span class="co"># picture wall lazy image loading library</span>
|
||||
├── <span class="kw">shaarli.css</span>, reset.css <span class="co"># Shaarli stylesheet.</span>
|
||||
├── <span class="kw">qr.*</span> <span class="co"># qr code generation library</span>
|
||||
└──<span class="kw">rain.tpl.class.php</span> <span class="co"># RainTPL templating library</span>
|
||||
<span class="kw">tpl/</span> <span class="co"># RainTPL templates for Shaarli. They are used to build the pages.</span>
|
||||
<span class="kw">images/</span> <span class="co"># Images and icons used in Shaarli</span>
|
||||
<span class="kw">data/</span> <span class="co"># data storage: bookmark database, configuration, logs, banlist…</span>
|
||||
├── <span class="kw">config.php</span> <span class="co"># Shaarli configuration (login, password, timezone, title…)</span>
|
||||
├── <span class="kw">datastore.php</span> <span class="co"># Your link database (compressed).</span>
|
||||
├── <span class="kw">ipban.php</span> <span class="co"># IP address ban system data</span>
|
||||
├── <span class="kw">lastupdatecheck.txt</span> <span class="co"># Update check timestamp file</span>
|
||||
└──<span class="kw">log.txt</span> <span class="co"># login/IPban log.</span>
|
||||
<span class="kw">cache/</span> <span class="co"># thumbnails cache</span>
|
||||
<span class="co"># This directory is automatically created. You can erase it anytime you want.</span>
|
||||
<span class="kw">tmp/</span> <span class="co"># Temporary directory for compiled RainTPL templates.</span>
|
||||
<span class="co"># This directory is automatically created. You can erase it anytime you want.</span></code></pre>
|
||||
</body>
|
||||
</html>
|
33
doc/Directory-structure.md
Normal file
33
doc/Directory-structure.md
Normal file
|
@ -0,0 +1,33 @@
|
|||
#Directory structure
|
||||
Here is the directory structure of Shaarli and the purpose of the different files:
|
||||
|
||||
```bash
|
||||
index.php # Main program
|
||||
application/ # Shaarli classes
|
||||
├── LinkDB.php
|
||||
└── Utils.php
|
||||
tests/ # Shaarli unitary & functional tests
|
||||
├── LinkDBTest.php
|
||||
├── utils # utilities to ease testing
|
||||
│ └── ReferenceLinkDB.php
|
||||
└── UtilsTest.php
|
||||
COPYING # Shaarli license
|
||||
inc/ # static assets and 3rd party libraries
|
||||
├── awesomplete.* # tags autocompletion library
|
||||
├── blazy.* # picture wall lazy image loading library
|
||||
├── shaarli.css, reset.css # Shaarli stylesheet.
|
||||
├── qr.* # qr code generation library
|
||||
└──rain.tpl.class.php # RainTPL templating library
|
||||
tpl/ # RainTPL templates for Shaarli. They are used to build the pages.
|
||||
images/ # Images and icons used in Shaarli
|
||||
data/ # data storage: bookmark database, configuration, logs, banlist…
|
||||
├── config.php # Shaarli configuration (login, password, timezone, title…)
|
||||
├── datastore.php # Your link database (compressed).
|
||||
├── ipban.php # IP address ban system data
|
||||
├── lastupdatecheck.txt # Update check timestamp file
|
||||
└──log.txt # login/IPban log.
|
||||
cache/ # thumbnails cache
|
||||
# This directory is automatically created. You can erase it anytime you want.
|
||||
tmp/ # Temporary directory for compiled RainTPL templates.
|
||||
# This directory is automatically created. You can erase it anytime you want.
|
||||
```
|
|
@ -1,167 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title></title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<h3 id="download-css-styles-for-shaarlis-listed-in-an-opml-file">Download CSS styles for shaarlis listed in an opml file</h3>
|
||||
<p>Example php script:</p>
|
||||
<pre><code><!---- ?php -->
|
||||
<!---- Copyright (c) 2014 Nicolas Delsaux (https://github.com/Riduidel) -->
|
||||
<!---- License: zlib (http://www.gzip.org/zlib/zlib_license.html) -->
|
||||
|
||||
/**
|
||||
* Source: https://github.com/Riduidel
|
||||
* Download css styles for shaarlis listed in an opml file
|
||||
*/
|
||||
define("SHAARLI_RSS_OPML", "https://www.ecirtam.net/shaarlirss/custom/people.opml");
|
||||
|
||||
define("THEMES_TEMP_FOLDER", "new_themes");
|
||||
|
||||
if(!file_exists(THEMES_TEMP_FOLDER)) {
|
||||
mkdir(THEMES_TEMP_FOLDER);
|
||||
}
|
||||
|
||||
function siteUrl($pathInSite) {
|
||||
$indexPos = strpos($pathInSite, "index.php");
|
||||
if(!$indexPos) {
|
||||
return $pathInSite;
|
||||
} else {
|
||||
return substr($pathInSite, 0, $indexPos);
|
||||
}
|
||||
}
|
||||
|
||||
function createShaarliHashFromOPMLL($opmlFile) {
|
||||
$result = array();
|
||||
$opml = file_get_contents($opmlFile);
|
||||
$opmlXml = simplexml_load_string($opml);
|
||||
$outlineElements = $opmlXml->xpath("body/outline");
|
||||
foreach($outlineElements as $site) {
|
||||
$siteUrl = siteUrl((string) $site['htmlUrl']);
|
||||
$result[$siteUrl]=((string) $site['text']);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
function getSiteFolder($url) {
|
||||
$domain = parse_url($url, PHP_URL_HOST);
|
||||
return THEMES_TEMP_FOLDER."/".str_replace(".", "_", $domain);
|
||||
}
|
||||
|
||||
function get_http_response_code($theURL) {
|
||||
$headers = get_headers($theURL);
|
||||
return substr($headers[0], 9, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* This makes the code PHP-5 only (particularly the call to "get_headers")
|
||||
*/
|
||||
function copyUserStyleFrom($url, $name, $knownStyles) {
|
||||
$userStyle = $url."inc/user.css";
|
||||
if(in_array($url, $knownStyles)) {
|
||||
// TODO add log message
|
||||
} else {
|
||||
$statusCode = get_http_response_code($userStyle);
|
||||
if(intval($statusCode)<300) {
|
||||
$styleSheet = file_get_contents($userStyle);
|
||||
$siteFolder = getSiteFolder($url);
|
||||
if(!file_exists($siteFolder)) {
|
||||
mkdir($siteFolder);
|
||||
}
|
||||
if(!file_exists($siteFolder.'/user.css')) {
|
||||
// Copy stylesheet
|
||||
file_put_contents($siteFolder.'/user.css', $styleSheet);
|
||||
}
|
||||
if(!file_exists($siteFolder.'/README.md')) {
|
||||
// Then write a readme.md file
|
||||
file_put_contents($siteFolder.'/README.md',
|
||||
"User style from ".$name."\n"
|
||||
."============================="
|
||||
."\n\n"
|
||||
."This stylesheet was downloaded from ".$userStyle." on ".date(DATE_RFC822)
|
||||
);
|
||||
}
|
||||
if(!file_exists($siteFolder.'/config.ini')) {
|
||||
// Write a config file containing useful informations
|
||||
file_put_contents($siteFolder.'/config.ini',
|
||||
"site_url=".$url."\n"
|
||||
."site_name=".$name."\n"
|
||||
);
|
||||
}
|
||||
if(!file_exists($siteFolder.'/home.png')) {
|
||||
// And finally copy generated thumbnail
|
||||
$homeThumb = $siteFolder.'/home.png';
|
||||
file_put_contents($siteFolder.'/home.png', file_get_contents(getThumbnailUrl($url)));
|
||||
}
|
||||
echo 'Theme have been downloaded from <a href="'.$url.'">'.$url.'</a> into '.$siteFolder
|
||||
.'. It looks like <img src="'.$homeThumb.'"><br/>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getThumbnailUrl($url) {
|
||||
return 'http://api.webthumbnail.org/?url='.$url;
|
||||
}
|
||||
|
||||
function copyUserStylesFrom($urlToNames, $knownStyles) {
|
||||
foreach($urlToNames as $url => $name) {
|
||||
copyUserStyleFrom($url, $name, $knownStyles);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reading directory list, courtesy of http://www.laughing-buddha.net/php/dirlist/
|
||||
* @param directory the directory we want to list files of
|
||||
* @return a simple array containing the list of absolute file paths. Notice that current file (".") and parent one("..")
|
||||
* are not listed here
|
||||
*/
|
||||
function getDirectoryList ($directory) {
|
||||
$realPath = realpath($directory);
|
||||
// create an array to hold directory list
|
||||
$results = array();
|
||||
// create a handler for the directory
|
||||
$handler = opendir($directory);
|
||||
// open directory and walk through the filenames
|
||||
while ($file = readdir($handler)) {
|
||||
// if file isn't this directory or its parent, add it to the results
|
||||
if ($file != "." && $file != "..") {
|
||||
$results[] = realpath($realPath . "/" . $file);
|
||||
}
|
||||
}
|
||||
// tidy up: close the handler
|
||||
closedir($handler);
|
||||
// done!
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start in themes folder and look in all subfolders for config.ini files.
|
||||
* These config.ini files allow us not to download styles again and again
|
||||
*/
|
||||
function findKnownStyles() {
|
||||
$result = array();
|
||||
$subFolders = getDirectoryList("themes");
|
||||
foreach($subFolders as $folder) {
|
||||
$configFile = $folder."/config.ini";
|
||||
if(file_exists($configFile)) {
|
||||
$iniParameters = parse_ini_file($configFile);
|
||||
array_push($result, $iniParameters['site_url']);
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
$knownStyles = findKnownStyles();
|
||||
copyUserStylesFrom(createShaarliHashFromOPMLL(SHAARLI_RSS_OPML), $knownStyles);
|
||||
|
||||
<!--- ? ----></code></pre>
|
||||
</body>
|
||||
</html>
|
229
doc/Download-CSS-styles-from-an-OPML-list.html
Normal file
229
doc/Download-CSS-styles-from-an-OPML-list.html
Normal file
|
@ -0,0 +1,229 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>Shaarli - Download CSS styles from an OPML list</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<style type="text/css">
|
||||
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
|
||||
margin: 0; padding: 0; vertical-align: baseline; border: none; }
|
||||
table.sourceCode { width: 100%; line-height: 100%; }
|
||||
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
|
||||
td.sourceCode { padding-left: 5px; }
|
||||
code > span.kw { color: #007020; font-weight: bold; }
|
||||
code > span.dt { color: #902000; }
|
||||
code > span.dv { color: #40a070; }
|
||||
code > span.bn { color: #40a070; }
|
||||
code > span.fl { color: #40a070; }
|
||||
code > span.ch { color: #4070a0; }
|
||||
code > span.st { color: #4070a0; }
|
||||
code > span.co { color: #60a0b0; font-style: italic; }
|
||||
code > span.ot { color: #007020; }
|
||||
code > span.al { color: #ff0000; font-weight: bold; }
|
||||
code > span.fu { color: #06287e; }
|
||||
code > span.er { color: #ff0000; font-weight: bold; }
|
||||
</style>
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="download-css-styles-from-an-opml-list">Download CSS styles from an OPML list</h1>
|
||||
<h3 id="download-css-styles-for-shaarlis-listed-in-an-opml-file">Download CSS styles for shaarlis listed in an opml file</h3>
|
||||
<p>Example php script:</p>
|
||||
<pre class="sourceCode php"><code class="sourceCode php"><!---- <span class="ot">?</span>php -->
|
||||
<!---- Copyright <span class="ot">(</span>c<span class="ot">)</span> <span class="dv">2014</span> Nicolas Delsaux <span class="ot">(</span>https<span class="ot">:</span><span class="co">//github.com/Riduidel) --></span>
|
||||
<!---- License: zlib <span class="ot">(</span>http:<span class="co">//www.gzip.org/zlib/zlib_license.html) --></span>
|
||||
|
||||
<span class="co">/**</span>
|
||||
<span class="co"> * Source: https://github.com/Riduidel</span>
|
||||
<span class="co"> * Download css styles for shaarlis listed in an opml file</span>
|
||||
<span class="co"> */</span>
|
||||
<span class="fu">define</span><span class="ot">(</span><span class="st">"SHAARLI_RSS_OPML"</span><span class="ot">,</span> <span class="st">"https://www.ecirtam.net/shaarlirss/custom/people.opml"</span><span class="ot">);</span>
|
||||
|
||||
<span class="fu">define</span><span class="ot">(</span><span class="st">"THEMES_TEMP_FOLDER"</span><span class="ot">,</span> <span class="st">"new_themes"</span><span class="ot">);</span>
|
||||
|
||||
<span class="kw">if</span><span class="ot">(</span>!<span class="fu">file_exists</span><span class="ot">(</span><span class="kw">THEMES_TEMP_FOLDER</span><span class="ot">))</span> {
|
||||
<span class="fu">mkdir</span><span class="ot">(</span><span class="kw">THEMES_TEMP_FOLDER</span><span class="ot">);</span>
|
||||
}
|
||||
|
||||
<span class="kw">function</span> siteUrl<span class="ot">(</span><span class="kw">$pathInSite</span><span class="ot">)</span> {
|
||||
<span class="kw">$indexPos</span> = <span class="fu">strpos</span><span class="ot">(</span><span class="kw">$pathInSite</span><span class="ot">,</span> <span class="st">"index.php"</span><span class="ot">);</span>
|
||||
<span class="kw">if</span><span class="ot">(</span>!<span class="kw">$indexPos</span><span class="ot">)</span> {
|
||||
<span class="kw">return</span> <span class="kw">$pathInSite</span><span class="ot">;</span>
|
||||
} <span class="kw">else</span> {
|
||||
<span class="kw">return</span> <span class="fu">substr</span><span class="ot">(</span><span class="kw">$pathInSite</span><span class="ot">,</span> <span class="dv">0</span><span class="ot">,</span> <span class="kw">$indexPos</span><span class="ot">);</span>
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">function</span> createShaarliHashFromOPMLL<span class="ot">(</span><span class="kw">$opmlFile</span><span class="ot">)</span> {
|
||||
<span class="kw">$result</span> = <span class="fu">array</span><span class="ot">();</span>
|
||||
<span class="kw">$opml</span> = <span class="fu">file_get_contents</span><span class="ot">(</span><span class="kw">$opmlFile</span><span class="ot">);</span>
|
||||
<span class="kw">$opmlXml</span> = <span class="fu">simplexml_load_string</span><span class="ot">(</span><span class="kw">$opml</span><span class="ot">);</span>
|
||||
<span class="kw">$outlineElements</span> = <span class="kw">$opmlXml</span>->xpath<span class="ot">(</span><span class="st">"body/outline"</span><span class="ot">);</span>
|
||||
<span class="kw">foreach</span><span class="ot">(</span><span class="kw">$outlineElements</span> <span class="kw">as</span> <span class="kw">$site</span><span class="ot">)</span> {
|
||||
<span class="kw">$siteUrl</span> = siteUrl<span class="ot">(</span><span class="dt">(string)</span> <span class="kw">$site</span><span class="ot">[</span><span class="st">'htmlUrl'</span><span class="ot">]);[](</span>.html<span class="ot">)</span>
|
||||
<span class="kw">$result</span><span class="ot">[</span><span class="kw">$siteUrl</span><span class="ot">]</span>=<span class="ot">(</span><span class="dt">(string)</span> <span class="kw">$site</span><span class="ot">[</span><span class="st">'text'</span><span class="ot">]);[](</span>.html<span class="ot">)</span>
|
||||
}
|
||||
<span class="kw">return</span> <span class="kw">$result</span><span class="ot">;</span>
|
||||
}
|
||||
|
||||
<span class="kw">function</span> getSiteFolder<span class="ot">(</span><span class="kw">$url</span><span class="ot">)</span> {
|
||||
<span class="kw">$domain</span> = <span class="fu">parse_url</span><span class="ot">(</span><span class="kw">$url</span><span class="ot">,</span> <span class="kw">PHP_URL_HOST</span><span class="ot">);</span>
|
||||
<span class="kw">return</span> <span class="kw">THEMES_TEMP_FOLDER</span>.<span class="st">"/"</span>.<span class="fu">str_replace</span><span class="ot">(</span><span class="st">"."</span><span class="ot">,</span> <span class="st">"_"</span><span class="ot">,</span> <span class="kw">$domain</span><span class="ot">);</span>
|
||||
}
|
||||
|
||||
<span class="kw">function</span> get_http_response_code<span class="ot">(</span><span class="kw">$theURL</span><span class="ot">)</span> {
|
||||
<span class="kw">$headers</span> = <span class="fu">get_headers</span><span class="ot">(</span><span class="kw">$theURL</span><span class="ot">);</span>
|
||||
<span class="kw">return</span> <span class="fu">substr</span><span class="ot">(</span><span class="kw">$headers</span><span class="ot">[</span><span class="dv">0</span><span class="ot">],</span> <span class="dv">9</span><span class="ot">,</span> <span class="dv">3</span><span class="ot">);[](</span>.html<span class="ot">)</span>
|
||||
}
|
||||
|
||||
<span class="co">/**</span>
|
||||
<span class="co"> * This makes the code PHP-5 only (particularly the call to "get_headers")</span>
|
||||
<span class="co"> */</span>
|
||||
<span class="kw">function</span> copyUserStyleFrom<span class="ot">(</span><span class="kw">$url</span><span class="ot">,</span> <span class="kw">$name</span><span class="ot">,</span> <span class="kw">$knownStyles</span><span class="ot">)</span> {
|
||||
<span class="kw">$userStyle</span> = <span class="kw">$url</span>.<span class="st">"inc/user.css"</span><span class="ot">;</span>
|
||||
<span class="kw">if</span><span class="ot">(</span><span class="fu">in_array</span><span class="ot">(</span><span class="kw">$url</span><span class="ot">,</span> <span class="kw">$knownStyles</span><span class="ot">))</span> {
|
||||
<span class="co">// TODO add log message</span>
|
||||
} <span class="kw">else</span> {
|
||||
<span class="kw">$statusCode</span> = get_http_response_code<span class="ot">(</span><span class="kw">$userStyle</span><span class="ot">);</span>
|
||||
<span class="kw">if</span><span class="ot">(</span><span class="fu">intval</span><span class="ot">(</span><span class="kw">$statusCode</span><span class="ot">)</span><<span class="dv">300</span><span class="ot">)</span> {
|
||||
<span class="kw">$styleSheet</span> = <span class="fu">file_get_contents</span><span class="ot">(</span><span class="kw">$userStyle</span><span class="ot">);</span>
|
||||
<span class="kw">$siteFolder</span> = getSiteFolder<span class="ot">(</span><span class="kw">$url</span><span class="ot">);</span>
|
||||
<span class="kw">if</span><span class="ot">(</span>!<span class="fu">file_exists</span><span class="ot">(</span><span class="kw">$siteFolder</span><span class="ot">))</span> {
|
||||
<span class="fu">mkdir</span><span class="ot">(</span><span class="kw">$siteFolder</span><span class="ot">);</span>
|
||||
}
|
||||
<span class="kw">if</span><span class="ot">(</span>!<span class="fu">file_exists</span><span class="ot">(</span><span class="kw">$siteFolder</span>.<span class="st">'/user.css'</span><span class="ot">))</span> {
|
||||
<span class="co">// Copy stylesheet</span>
|
||||
<span class="fu">file_put_contents</span><span class="ot">(</span><span class="kw">$siteFolder</span>.<span class="st">'/user.css'</span><span class="ot">,</span> <span class="kw">$styleSheet</span><span class="ot">);</span>
|
||||
}
|
||||
<span class="kw">if</span><span class="ot">(</span>!<span class="fu">file_exists</span><span class="ot">(</span><span class="kw">$siteFolder</span>.<span class="st">'/README.md'</span><span class="ot">))</span> {
|
||||
<span class="co">// Then write a readme.md file</span>
|
||||
<span class="fu">file_put_contents</span><span class="ot">(</span><span class="kw">$siteFolder</span>.<span class="st">'/README.md'</span><span class="ot">,</span>
|
||||
<span class="st">"User style from "</span>.<span class="kw">$name</span>.<span class="st">"</span><span class="kw">\n</span><span class="st">"</span>
|
||||
.<span class="st">"============================="</span>
|
||||
.<span class="st">"</span><span class="kw">\n\n</span><span class="st">"</span>
|
||||
.<span class="st">"This stylesheet was downloaded from "</span>.<span class="kw">$userStyle</span>.<span class="st">" on "</span>.<span class="fu">date</span><span class="ot">(</span><span class="kw">DATE_RFC822</span><span class="ot">)</span>
|
||||
<span class="ot">);</span>
|
||||
}
|
||||
<span class="kw">if</span><span class="ot">(</span>!<span class="fu">file_exists</span><span class="ot">(</span><span class="kw">$siteFolder</span>.<span class="st">'/config.ini'</span><span class="ot">))</span> {
|
||||
<span class="co">// Write a config file containing useful informations</span>
|
||||
<span class="fu">file_put_contents</span><span class="ot">(</span><span class="kw">$siteFolder</span>.<span class="st">'/config.ini'</span><span class="ot">,</span>
|
||||
<span class="st">"site_url="</span>.<span class="kw">$url</span>.<span class="st">"</span><span class="kw">\n</span><span class="st">"</span>
|
||||
.<span class="st">"site_name="</span>.<span class="kw">$name</span>.<span class="st">"</span><span class="kw">\n</span><span class="st">"</span>
|
||||
<span class="ot">);</span>
|
||||
}
|
||||
<span class="kw">if</span><span class="ot">(</span>!<span class="fu">file_exists</span><span class="ot">(</span><span class="kw">$siteFolder</span>.<span class="st">'/home.png'</span><span class="ot">))</span> {
|
||||
<span class="co">// And finally copy generated thumbnail</span>
|
||||
<span class="kw">$homeThumb</span> = <span class="kw">$siteFolder</span>.<span class="st">'/home.png'</span><span class="ot">;</span>
|
||||
<span class="fu">file_put_contents</span><span class="ot">(</span><span class="kw">$siteFolder</span>.<span class="st">'/home.png'</span><span class="ot">,</span> <span class="fu">file_get_contents</span><span class="ot">(</span>getThumbnailUrl<span class="ot">(</span><span class="kw">$url</span><span class="ot">)));</span>
|
||||
}
|
||||
<span class="fu">echo</span> <span class="st">'Theme have been downloaded from <a href="'</span>.<span class="kw">$url</span>.<span class="st">'">'</span>.<span class="kw">$url</span>.<span class="st">'</a> into '</span>.<span class="kw">$siteFolder</span>
|
||||
.<span class="st">'. It looks like <img src="'</span>.<span class="kw">$homeThumb</span>.<span class="st">'"><br/>'</span><span class="ot">;</span>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">function</span> getThumbnailUrl<span class="ot">(</span><span class="kw">$url</span><span class="ot">)</span> {
|
||||
<span class="kw">return</span> <span class="st">'http://api.webthumbnail.org/?url='</span>.<span class="kw">$url</span><span class="ot">;</span>
|
||||
}
|
||||
|
||||
<span class="kw">function</span> copyUserStylesFrom<span class="ot">(</span><span class="kw">$urlToNames</span><span class="ot">,</span> <span class="kw">$knownStyles</span><span class="ot">)</span> {
|
||||
<span class="kw">foreach</span><span class="ot">(</span><span class="kw">$urlToNames</span> <span class="kw">as</span> <span class="kw">$url</span> => <span class="kw">$name</span><span class="ot">)</span> {
|
||||
copyUserStyleFrom<span class="ot">(</span><span class="kw">$url</span><span class="ot">,</span> <span class="kw">$name</span><span class="ot">,</span> <span class="kw">$knownStyles</span><span class="ot">);</span>
|
||||
}
|
||||
}
|
||||
|
||||
<span class="co">/**</span>
|
||||
<span class="co"> * Reading directory list, courtesy of http://www.laughing-buddha.net/php/dirlist/</span>
|
||||
<span class="co"> * </span><span class="kw">@param</span><span class="co"> </span><span class="kw">directory</span><span class="co"> the directory we want to list files of</span>
|
||||
<span class="co"> * </span><span class="kw">@return</span><span class="co"> a simple array containing the list of absolute file paths. Notice that current file (".") and parent one("..")</span>
|
||||
<span class="co"> * are not listed here</span>
|
||||
<span class="co"> */</span>
|
||||
<span class="kw">function</span> getDirectoryList <span class="ot">(</span><span class="kw">$directory</span><span class="ot">)</span> {
|
||||
<span class="kw">$realPath</span> = <span class="fu">realpath</span><span class="ot">(</span><span class="kw">$directory</span><span class="ot">);</span>
|
||||
<span class="co">// create an array to hold directory list</span>
|
||||
<span class="kw">$results</span> = <span class="fu">array</span><span class="ot">();</span>
|
||||
<span class="co">// create a handler for the directory</span>
|
||||
<span class="kw">$handler</span> = <span class="fu">opendir</span><span class="ot">(</span><span class="kw">$directory</span><span class="ot">);</span>
|
||||
<span class="co">// open directory and walk through the filenames</span>
|
||||
<span class="kw">while</span> <span class="ot">(</span><span class="kw">$file</span> = <span class="fu">readdir</span><span class="ot">(</span><span class="kw">$handler</span><span class="ot">))</span> {
|
||||
<span class="co">// if file isn't this directory or its parent, add it to the results</span>
|
||||
<span class="kw">if</span> <span class="ot">(</span><span class="kw">$file</span> != <span class="st">"."</span> && <span class="kw">$file</span> != <span class="st">".."</span><span class="ot">)</span> {
|
||||
<span class="kw">$results</span><span class="ot">[</span> = <span class="fu">realpath</span><span class="ot">(</span><span class="kw">$realPath</span> . <span class="st">"/"</span> . <span class="kw">$file</span><span class="ot">);](</span>-=-<span class="fu">realpath</span><span class="ot">(</span><span class="kw">$realPath</span>-.-<span class="st">"/"</span>-.-<span class="kw">$file</span><span class="ot">);</span>.html<span class="ot">)</span>
|
||||
}
|
||||
}
|
||||
<span class="co">// tidy up: close the handler</span>
|
||||
<span class="fu">closedir</span><span class="ot">(</span><span class="kw">$handler</span><span class="ot">);</span>
|
||||
<span class="co">// done!</span>
|
||||
<span class="kw">return</span> <span class="kw">$results</span><span class="ot">;</span>
|
||||
}
|
||||
|
||||
<span class="co">/**</span>
|
||||
<span class="co"> * Start in themes folder and look in all subfolders for config.ini files. </span>
|
||||
<span class="co"> * These config.ini files allow us not to download styles again and again</span>
|
||||
<span class="co"> */</span>
|
||||
<span class="kw">function</span> findKnownStyles<span class="ot">()</span> {
|
||||
<span class="kw">$result</span> = <span class="fu">array</span><span class="ot">();</span>
|
||||
<span class="kw">$subFolders</span> = getDirectoryList<span class="ot">(</span><span class="st">"themes"</span><span class="ot">);</span>
|
||||
<span class="kw">foreach</span><span class="ot">(</span><span class="kw">$subFolders</span> <span class="kw">as</span> <span class="kw">$folder</span><span class="ot">)</span> {
|
||||
<span class="kw">$configFile</span> = <span class="kw">$folder</span>.<span class="st">"/config.ini"</span><span class="ot">;</span>
|
||||
<span class="kw">if</span><span class="ot">(</span><span class="fu">file_exists</span><span class="ot">(</span><span class="kw">$configFile</span><span class="ot">))</span> {
|
||||
<span class="kw">$iniParameters</span> = <span class="fu">parse_ini_file</span><span class="ot">(</span><span class="kw">$configFile</span><span class="ot">);</span>
|
||||
<span class="fu">array_push</span><span class="ot">(</span><span class="kw">$result</span><span class="ot">,</span> <span class="kw">$iniParameters</span><span class="ot">[</span><span class="st">'site_url'</span><span class="ot">]);[](</span>.html<span class="ot">)</span>
|
||||
}
|
||||
}
|
||||
<span class="kw">return</span> <span class="kw">$result</span><span class="ot">;</span>
|
||||
}
|
||||
|
||||
<span class="kw">$knownStyles</span> = findKnownStyles<span class="ot">();</span>
|
||||
copyUserStylesFrom<span class="ot">(</span>createShaarliHashFromOPMLL<span class="ot">(</span><span class="kw">SHAARLI_RSS_OPML</span><span class="ot">),</span> <span class="kw">$knownStyles</span><span class="ot">);</span>
|
||||
|
||||
<!--- <span class="ot">?</span> ----></code></pre>
|
||||
</body>
|
||||
</html>
|
|
@ -1,7 +1,8 @@
|
|||
#Download CSS styles from an OPML list
|
||||
###Download CSS styles for shaarlis listed in an opml file
|
||||
Example php script:
|
||||
|
||||
```
|
||||
```php
|
||||
<!---- ?php -->
|
||||
<!---- Copyright (c) 2014 Nicolas Delsaux (https://github.com/Riduidel) -->
|
||||
<!---- License: zlib (http://www.gzip.org/zlib/zlib_license.html) -->
|
||||
|
@ -33,8 +34,8 @@ function createShaarliHashFromOPMLL($opmlFile) {
|
|||
$opmlXml = simplexml_load_string($opml);
|
||||
$outlineElements = $opmlXml->xpath("body/outline");
|
||||
foreach($outlineElements as $site) {
|
||||
$siteUrl = siteUrl((string) $site['htmlUrl']);
|
||||
$result[$siteUrl]=((string) $site['text']);
|
||||
$siteUrl = siteUrl((string) $site['htmlUrl']);[](.html)
|
||||
$result[$siteUrl]=((string) $site['text']);[](.html)
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
@ -46,7 +47,7 @@ function getSiteFolder($url) {
|
|||
|
||||
function get_http_response_code($theURL) {
|
||||
$headers = get_headers($theURL);
|
||||
return substr($headers[0], 9, 3);
|
||||
return substr($headers[0], 9, 3);[](.html)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -121,7 +122,7 @@ function getDirectoryList ($directory) {
|
|||
while ($file = readdir($handler)) {
|
||||
// if file isn't this directory or its parent, add it to the results
|
||||
if ($file != "." && $file != "..") {
|
||||
$results[] = realpath($realPath . "/" . $file);
|
||||
$results[ = realpath($realPath . "/" . $file);](-=-realpath($realPath-.-"/"-.-$file);.html)
|
||||
}
|
||||
}
|
||||
// tidy up: close the handler
|
||||
|
@ -141,7 +142,7 @@ function findKnownStyles() {
|
|||
$configFile = $folder."/config.ini";
|
||||
if(file_exists($configFile)) {
|
||||
$iniParameters = parse_ini_file($configFile);
|
||||
array_push($result, $iniParameters['site_url']);
|
||||
array_push($result, $iniParameters['site_url']);[](.html)
|
||||
}
|
||||
}
|
||||
return $result;
|
|
@ -4,7 +4,7 @@
|
|||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title></title>
|
||||
<title>Shaarli - Example patch add new via field for links</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
|
@ -12,12 +12,55 @@
|
|||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="example-patch-add-new-via-field-for-links">Example patch add new via field for links</h1>
|
||||
<p>Example patch to add a new field ("via") for links, an input field to set the "via" property from the "edit link" dialog, and display the "via" field in the link list display. <strong>Untested, use at your own risk</strong></p>
|
||||
<p>Thanks to @Knah-Tsaeb in <a href="https://github.com/sebsauvage/Shaarli/pull/158">https://github.com/sebsauvage/Shaarli/pull/158</a></p>
|
||||
<p>Thanks to @Knah-Tsaeb in <a href="https://github.com/sebsauvage/Shaarli/pull/158" class="uri">https://github.com/sebsauvage/Shaarli/pull/158</a></p>
|
||||
<pre><code>From e0f363c18e8fe67990ed2bb1a08652e24e70bbcb Mon Sep 17 00:00:00 2001
|
||||
From: Knah Tsaeb <knah-tsaeb@knah-tsaeb.org>
|
||||
Date: Fri, 11 Oct 2013 15:18:37 +0200
|
||||
Subject: [PATCH] Add a "via"/origin property for links, add new input in "edit link" dialog
|
||||
Subject: [PATCH] Add a "via"/origin property for links, add new input in "edit link" dialog[](.html)
|
||||
Thanks to:
|
||||
* https://github.com/Knah-Tsaeb/Shaarli/commit/040eb18ec8cdabd5ea855e108f81f97fbf0478c4
|
||||
* https://github.com/Knah-Tsaeb/Shaarli/commit/4123658eae44d7564d1128ce52ddd5689efee813
|
||||
|
@ -33,27 +76,27 @@ diff --git a/index.php b/index.php
|
|||
index 6fae2f8..53f798e 100644
|
||||
--- a/index.php
|
||||
+++ b/index.php
|
||||
@@ -436,6 +436,12 @@ if (isset($_POST['login']))
|
||||
@@ -436,6 +436,12 @@ if (isset($_POST['login']))[](.html)
|
||||
// ------------------------------------------------------------------------------------------
|
||||
// Misc utility functions:
|
||||
|
||||
+// Try to get just domain for @via
|
||||
+function getJustDomain($url){
|
||||
+ $parts = parse_url($url);
|
||||
+ return trim($parts['host']);
|
||||
+ return trim($parts['host']);[](.html)
|
||||
+ }
|
||||
+
|
||||
// Returns the server URL (including port and http/https), without path.
|
||||
// e.g. "http://myserver.com:8080"
|
||||
// You can append $_SERVER['SCRIPT_NAME'] to get the current script URL.
|
||||
// You can append $_SERVER['SCRIPT_NAME'] to get the current script URL.[](.html)
|
||||
@@ -799,7 +805,8 @@ class linkdb implements Iterator, Countable, ArrayAccess
|
||||
$found= (strpos(strtolower($l['title']),$s)!==false)
|
||||
|| (strpos(strtolower($l['description']),$s)!==false)
|
||||
|| (strpos(strtolower($l['url']),$s)!==false)
|
||||
- || (strpos(strtolower($l['tags']),$s)!==false);
|
||||
+ || (strpos(strtolower($l['tags']),$s)!==false)
|
||||
+ || (!empty($l['via']) && (strpos(strtolower($l['via']),$s)!==false));
|
||||
if ($found) $filtered[$l['linkdate']] = $l;
|
||||
$found= (strpos(strtolower($l['title']),$s)!==false)[](.html)
|
||||
|| (strpos(strtolower($l['description']),$s)!==false)[](.html)
|
||||
|| (strpos(strtolower($l['url']),$s)!==false)[](.html)
|
||||
- || (strpos(strtolower($l['tags']),$s)!==false);[](.html)
|
||||
+ || (strpos(strtolower($l['tags']),$s)!==false)[](.html)
|
||||
+ || (!empty($l['via']) && (strpos(strtolower($l['via']),$s)!==false));[](.html)
|
||||
if ($found) $filtered[$l['linkdate'[ = $l;](-=-$l;.html)
|
||||
}
|
||||
krsort($filtered);
|
||||
@@ -814,7 +821,7 @@ class linkdb implements Iterator, Countable, ArrayAccess
|
||||
|
@ -63,74 +106,74 @@ index 6fae2f8..53f798e 100644
|
|||
- foreach($this->links as $l)
|
||||
+ foreach($this-> links as $l)
|
||||
{
|
||||
$linktags = explode(' ',($casesensitive?$l['tags']:strtolower($l['tags'])));
|
||||
$linktags = explode(' ',($casesensitive?$l['tags']:strtolower($l['tags'])));[](.html)
|
||||
if (count(array_intersect($linktags,$searchtags)) == count($searchtags))
|
||||
@@ -905,7 +912,7 @@ function showRSS()
|
||||
else $linksToDisplay = $LINKSDB;
|
||||
$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.
|
||||
if (!empty($_GET['nb'])) // In URL, you can specificy the number of links. Example: nb=200 or nb=all for all links.[](.html)
|
||||
- {
|
||||
+ {
|
||||
$nblinksToDisplay = $_GET['nb']=='all' ? count($linksToDisplay) : max($_GET['nb']+0,1) ;
|
||||
$nblinksToDisplay = $_GET['nb']=='all' ? count($linksToDisplay) : max($_GET['nb']+0,1) ;[](.html)
|
||||
}
|
||||
|
||||
@@ -944,7 +951,12 @@ function showRSS()
|
||||
// If user wants permalinks first, put the final link in description
|
||||
if ($usepermalinks===true) $descriptionlink = '(<a href="'.$absurl.'">Link</a>)';
|
||||
if (strlen($link['description'])>0) $descriptionlink = '<br>'.$descriptionlink;
|
||||
- echo '<description><![CDATA['.nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description'])))).$descriptionlink.']]></description>'."\n</item>\n";
|
||||
+ if(!empty($link['via'])){
|
||||
+ $via = '<br>Origine => <a href="'.htmlspecialchars($link['via']).'">'.htmlspecialchars(getJustDomain($link['via'])).'</a>';
|
||||
if (strlen($link['description'])>0) $descriptionlink = '<br>'.$descriptionlink;[](.html)
|
||||
- echo '<description><![CDATA['.nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description'])))).$descriptionlink.'[></description>'."\n</item>\n";](></description>'."\n</item>\n";.html)
|
||||
+ if(!empty($link['via'])){[](.html)
|
||||
+ $via = '<br>Origine => <a href="'.htmlspecialchars($link['via']).'">'.htmlspecialchars(getJustDomain($link['via'])).'</a>';[](.html)
|
||||
+ } else {
|
||||
+ $via = '';
|
||||
+ }
|
||||
+ echo '<description><![CDATA['.nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description'])))).$via.$descriptionlink.']]></description>'."\n</item>\n";
|
||||
+ echo '<description><![CDATA['.nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description'])))).$via.$descriptionlink.'[></description>'."\n</item>\n";](></description>'."\n</item>\n";.html)
|
||||
$i++;
|
||||
}
|
||||
echo '</channel></rss><!-- Cached version of '.htmlspecialchars(pageUrl()).' -->';
|
||||
@@ -980,7 +992,7 @@ function showATOM()
|
||||
else $linksToDisplay = $LINKSDB;
|
||||
$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.
|
||||
if (!empty($_GET['nb'])) // In URL, you can specificy the number of links. Example: nb=200 or nb=all for all links.[](.html)
|
||||
- {
|
||||
+ {
|
||||
$nblinksToDisplay = $_GET['nb']=='all' ? count($linksToDisplay) : max($_GET['nb']+0,1) ;
|
||||
$nblinksToDisplay = $_GET['nb']=='all' ? count($linksToDisplay) : max($_GET['nb']+0,1) ;[](.html)
|
||||
}
|
||||
|
||||
@@ -1006,11 +1018,16 @@ function showATOM()
|
||||
|
||||
// Add permalink in description
|
||||
$descriptionlink = htmlspecialchars('(<a href="'.$guid.'">Permalink</a>)');
|
||||
+ if(isset($link['via']) && !empty($link['via'])){
|
||||
+ $via = htmlspecialchars('</br> Origine => <a href="'.$link['via'].'">'.getJustDomain($link['via']).'</a>');
|
||||
+ if(isset($link['via']) && !empty($link['via'])){[](.html)
|
||||
+ $via = htmlspecialchars('</br> Origine => <a href="'.$link['via'].'">'.getJustDomain($link['via']).'</a>');[](.html)
|
||||
+ } else {
|
||||
+ $via = '';
|
||||
+ }
|
||||
// If user wants permalinks first, put the final link in description
|
||||
if ($usepermalinks===true) $descriptionlink = htmlspecialchars('(<a href="'.$absurl.'">Link</a>)');
|
||||
if (strlen($link['description'])>0) $descriptionlink = '&lt;br&gt;'.$descriptionlink;
|
||||
if (strlen($link['description'])>0) $descriptionlink = '&lt;br&gt;'.$descriptionlink;[](.html)
|
||||
|
||||
- $entries.='<content type="html">'.htmlspecialchars(nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description']))))).$descriptionlink."</content>\n";
|
||||
+ $entries.='<content type="html">'.htmlspecialchars(nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description']))))).$descriptionlink.$via."</content>\n";
|
||||
if ($link['tags']!='') // Adding tags to each ATOM entry (as mentioned in ATOM specification)
|
||||
- $entries.='<content type="html">'.htmlspecialchars(nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description']))))).$descriptionlink."</content>\n";[](.html)
|
||||
+ $entries.='<content type="html">'.htmlspecialchars(nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description']))))).$descriptionlink.$via."</content>\n";[](.html)
|
||||
if ($link['tags']!='') // Adding tags to each ATOM entry (as mentioned in ATOM specification)[](.html)
|
||||
{
|
||||
foreach(explode(' ',$link['tags']) as $tag)
|
||||
foreach(explode(' ',$link['tags']) as $tag)[](.html)
|
||||
@@ -1478,7 +1495,7 @@ function renderPage()
|
||||
if (!startsWith($url,'http:') && !startsWith($url,'https:') && !startsWith($url,'ftp:') && !startsWith($url,'magnet:') && !startsWith($url,'?'))
|
||||
$url = 'http://'.$url;
|
||||
$link = array('title'=>trim($_POST['lf_title']),'url'=>$url,'description'=>trim($_POST['lf_description']),'private'=>(isset($_POST['lf_private']) ? 1 : 0),
|
||||
$link = array('title'=>trim($_POST['lf_title']),'url'=>$url,'description'=>trim($_POST['lf_description']),'private'=>(isset($_POST['lf_private']) ? 1 : 0),[](.html)
|
||||
- 'linkdate'=>$linkdate,'tags'=>str_replace(',',' ',$tags));
|
||||
+ 'linkdate'=>$linkdate,'tags'=>str_replace(',',' ',$tags), 'via'=>trim($_POST['lf_via']));
|
||||
if ($link['title']=='') $link['title']=$link['url']; // If title is empty, use the URL as title.
|
||||
$LINKSDB[$linkdate] = $link;
|
||||
+ 'linkdate'=>$linkdate,'tags'=>str_replace(',',' ',$tags), 'via'=>trim($_POST['lf_via']));[](.html)
|
||||
if ($link['title']=='') $link['title']=$link['url']; // If title is empty, use the URL as title.[](.html)
|
||||
$LINKSDB[$linkdate] = $link;[](.html)
|
||||
$LINKSDB->savedb(); // Save to disk.
|
||||
@@ -1556,7 +1573,8 @@ function renderPage()
|
||||
$title = (empty($_GET['title']) ? '' : $_GET['title'] ); // Get title if it was provided in URL (by the bookmarklet).
|
||||
$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
|
||||
+ $via = (empty($_GET['via']) ? '' : $_GET['via'] );
|
||||
+ $private = (!empty($_GET['private']) && $_GET['private'] === "1" ? 1 : 0); // Get private if it was provided in URL
|
||||
$title = (empty($_GET['title']) ? '' : $_GET['title'] ); // Get title if it was provided in URL (by the bookmarklet).[](.html)
|
||||
$description = (empty($_GET['description']) ? '' : $_GET['description']); // Get description if it was provided in URL (by the bookmarklet). [Bronco added that][](.html)
|
||||
$tags = (empty($_GET['tags']) ? '' : $_GET['tags'] ); // Get tags if it was provided in URL[](.html)
|
||||
- $private = (!empty($_GET['private']) && $_GET['private'] === "1" ? 1 : 0); // Get private if it was provided in URL [](.html)
|
||||
+ $via = (empty($_GET['via']) ? '' : $_GET['via'] );[](.html)
|
||||
+ $private = (!empty($_GET['private']) && $_GET['private'] === "1" ? 1 : 0); // Get private if it was provided in URL[](.html)
|
||||
if (($url!='') && parse_url($url,PHP_URL_SCHEME)=='') $url = 'http://'.$url;
|
||||
// If this is an HTTP link, we try go get the page to extract the title (otherwise we will to straight to the edit form.)
|
||||
if (empty($title) && parse_url($url,PHP_URL_SCHEME)=='http')
|
||||
|
@ -141,10 +184,10 @@ index 6fae2f8..53f798e 100644
|
|||
-
|
||||
+
|
||||
// If found, extract encoding.
|
||||
if (!empty($meta[0]))
|
||||
if (!empty($meta[0]))[](.html)
|
||||
{
|
||||
@@ -1577,7 +1595,7 @@ function renderPage()
|
||||
$html_charset = (!empty($enc[1])) ? strtolower($enc[1]) : 'utf-8';
|
||||
$html_charset = (!empty($enc[1])) ? strtolower($enc[1]) : 'utf-8';[](.html)
|
||||
}
|
||||
else { $html_charset = 'utf-8'; }
|
||||
-
|
||||
|
@ -162,13 +205,13 @@ index 6fae2f8..53f798e 100644
|
|||
|
||||
$PAGE = new pageBuilder;
|
||||
@@ -1842,6 +1860,9 @@ function buildLinkList($PAGE,$LINKSDB)
|
||||
$taglist = explode(' ',$link['tags']);
|
||||
$taglist = explode(' ',$link['tags']);[](.html)
|
||||
uasort($taglist, 'strcasecmp');
|
||||
$link['taglist']=$taglist;
|
||||
+ if(!empty($link['via'])){
|
||||
+ $link['via']=htmlspecialchars($link['via']);
|
||||
$link['taglist']=$taglist;[](.html)
|
||||
+ if(!empty($link['via'])){[](.html)
|
||||
+ $link['via']=htmlspecialchars($link['via']);[](.html)
|
||||
+ }
|
||||
$linkDisp[$keys[$i]] = $link;
|
||||
$linkDisp[$keys[$i[ = $link;](-=-$link;.html)
|
||||
$i++;
|
||||
}
|
||||
diff --git a/tpl/editlink.html b/tpl/editlink.html
|
||||
|
@ -180,7 +223,7 @@ index 4a2c30c..14d4f9c 100644
|
|||
<i>Description</i><br><textarea name="lf_description" rows="4" cols="25" style="width:100%">{$link.description|htmlspecialchars}</textarea><br>
|
||||
<i>Tags</i><br><input type="text" id="lf_tags" name="lf_tags" value="{$link.tags|htmlspecialchars}" style="width:100%"><br>
|
||||
+ <i>Origine</i><br><input type="text" name="lf_via" value="{$link.via|htmlspecialchars}" style="width:100%"><br>
|
||||
{if condition="($link_is_new && $GLOBALS['privateLinkByDefault']==true) || $link.private == true"}
|
||||
{if condition="($link_is_new && $GLOBALS['privateLinkByDefault']==true) || $link.private == true"}[](.html)
|
||||
<input type="checkbox" checked="checked" name="lf_private" id="lf_private">
|
||||
&nbsp;<label for="lf_private"><i>Private</i></label><br>
|
||||
diff --git a/tpl/linklist.html b/tpl/linklist.html
|
||||
|
@ -192,7 +235,7 @@ index ddc38cb..0a8475f 100644
|
|||
<br>
|
||||
{if="$value.description"}<div class="linkdescription"{if condition="$search_type=='permalink'"} style="max-height:none !important;"{/if}>{$value.description}</div>{/if}
|
||||
+ {if condition="isset($value.via) && !empty($value.via)"}<div><a href="{$value.via}">Origine => {$value.via|getJustDomain}</a></div>{/if}
|
||||
{if="!$GLOBALS['config']['HIDE_TIMESTAMPS'] || isLoggedIn()"}
|
||||
{if="!$GLOBALS['config'['HIDE_TIMESTAMPS'] || isLoggedIn()"}]('HIDE_TIMESTAMPS']-||-isLoggedIn()"}.html)
|
||||
<span class="linkdate" title="Permalink"><a href="?{$value.linkdate|smallHash}">{$value.localdate|htmlspecialchars} - permalink</a> - </span>
|
||||
{else}
|
||||
--
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#Example patch add new via field for links
|
||||
Example patch to add a new field ("via") for links, an input field to set the "via" property from the "edit link" dialog, and display the "via" field in the link list display. **Untested, use at your own risk**
|
||||
|
||||
Thanks to @Knah-Tsaeb in https://github.com/sebsauvage/Shaarli/pull/158
|
||||
|
@ -6,7 +7,7 @@ Thanks to @Knah-Tsaeb in https://github.com/sebsauvage/Shaarli/pull/158
|
|||
From e0f363c18e8fe67990ed2bb1a08652e24e70bbcb Mon Sep 17 00:00:00 2001
|
||||
From: Knah Tsaeb <knah-tsaeb@knah-tsaeb.org>
|
||||
Date: Fri, 11 Oct 2013 15:18:37 +0200
|
||||
Subject: [PATCH] Add a "via"/origin property for links, add new input in "edit link" dialog
|
||||
Subject: [PATCH] Add a "via"/origin property for links, add new input in "edit link" dialog[](.html)
|
||||
Thanks to:
|
||||
* https://github.com/Knah-Tsaeb/Shaarli/commit/040eb18ec8cdabd5ea855e108f81f97fbf0478c4
|
||||
* https://github.com/Knah-Tsaeb/Shaarli/commit/4123658eae44d7564d1128ce52ddd5689efee813
|
||||
|
@ -22,27 +23,27 @@ diff --git a/index.php b/index.php
|
|||
index 6fae2f8..53f798e 100644
|
||||
--- a/index.php
|
||||
+++ b/index.php
|
||||
@@ -436,6 +436,12 @@ if (isset($_POST['login']))
|
||||
@@ -436,6 +436,12 @@ if (isset($_POST['login']))[](.html)
|
||||
// ------------------------------------------------------------------------------------------
|
||||
// Misc utility functions:
|
||||
|
||||
+// Try to get just domain for @via
|
||||
+function getJustDomain($url){
|
||||
+ $parts = parse_url($url);
|
||||
+ return trim($parts['host']);
|
||||
+ return trim($parts['host']);[](.html)
|
||||
+ }
|
||||
+
|
||||
// Returns the server URL (including port and http/https), without path.
|
||||
// e.g. "http://myserver.com:8080"
|
||||
// You can append $_SERVER['SCRIPT_NAME'] to get the current script URL.
|
||||
// You can append $_SERVER['SCRIPT_NAME'] to get the current script URL.[](.html)
|
||||
@@ -799,7 +805,8 @@ class linkdb implements Iterator, Countable, ArrayAccess
|
||||
$found= (strpos(strtolower($l['title']),$s)!==false)
|
||||
|| (strpos(strtolower($l['description']),$s)!==false)
|
||||
|| (strpos(strtolower($l['url']),$s)!==false)
|
||||
- || (strpos(strtolower($l['tags']),$s)!==false);
|
||||
+ || (strpos(strtolower($l['tags']),$s)!==false)
|
||||
+ || (!empty($l['via']) && (strpos(strtolower($l['via']),$s)!==false));
|
||||
if ($found) $filtered[$l['linkdate']] = $l;
|
||||
$found= (strpos(strtolower($l['title']),$s)!==false)[](.html)
|
||||
|| (strpos(strtolower($l['description']),$s)!==false)[](.html)
|
||||
|| (strpos(strtolower($l['url']),$s)!==false)[](.html)
|
||||
- || (strpos(strtolower($l['tags']),$s)!==false);[](.html)
|
||||
+ || (strpos(strtolower($l['tags']),$s)!==false)[](.html)
|
||||
+ || (!empty($l['via']) && (strpos(strtolower($l['via']),$s)!==false));[](.html)
|
||||
if ($found) $filtered[$l['linkdate'[ = $l;](-=-$l;.html)
|
||||
}
|
||||
krsort($filtered);
|
||||
@@ -814,7 +821,7 @@ class linkdb implements Iterator, Countable, ArrayAccess
|
||||
|
@ -52,74 +53,74 @@ index 6fae2f8..53f798e 100644
|
|||
- foreach($this->links as $l)
|
||||
+ foreach($this-> links as $l)
|
||||
{
|
||||
$linktags = explode(' ',($casesensitive?$l['tags']:strtolower($l['tags'])));
|
||||
$linktags = explode(' ',($casesensitive?$l['tags']:strtolower($l['tags'])));[](.html)
|
||||
if (count(array_intersect($linktags,$searchtags)) == count($searchtags))
|
||||
@@ -905,7 +912,7 @@ function showRSS()
|
||||
else $linksToDisplay = $LINKSDB;
|
||||
$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.
|
||||
if (!empty($_GET['nb'])) // In URL, you can specificy the number of links. Example: nb=200 or nb=all for all links.[](.html)
|
||||
- {
|
||||
+ {
|
||||
$nblinksToDisplay = $_GET['nb']=='all' ? count($linksToDisplay) : max($_GET['nb']+0,1) ;
|
||||
$nblinksToDisplay = $_GET['nb']=='all' ? count($linksToDisplay) : max($_GET['nb']+0,1) ;[](.html)
|
||||
}
|
||||
|
||||
@@ -944,7 +951,12 @@ function showRSS()
|
||||
// If user wants permalinks first, put the final link in description
|
||||
if ($usepermalinks===true) $descriptionlink = '(<a href="'.$absurl.'">Link</a>)';
|
||||
if (strlen($link['description'])>0) $descriptionlink = '<br>'.$descriptionlink;
|
||||
- echo '<description><![CDATA['.nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description'])))).$descriptionlink.']]></description>'."\n</item>\n";
|
||||
+ if(!empty($link['via'])){
|
||||
+ $via = '<br>Origine => <a href="'.htmlspecialchars($link['via']).'">'.htmlspecialchars(getJustDomain($link['via'])).'</a>';
|
||||
if (strlen($link['description'])>0) $descriptionlink = '<br>'.$descriptionlink;[](.html)
|
||||
- echo '<description><![CDATA['.nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description'])))).$descriptionlink.'[></description>'."\n</item>\n";](></description>'."\n</item>\n";.html)
|
||||
+ if(!empty($link['via'])){[](.html)
|
||||
+ $via = '<br>Origine => <a href="'.htmlspecialchars($link['via']).'">'.htmlspecialchars(getJustDomain($link['via'])).'</a>';[](.html)
|
||||
+ } else {
|
||||
+ $via = '';
|
||||
+ }
|
||||
+ echo '<description><![CDATA['.nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description'])))).$via.$descriptionlink.']]></description>'."\n</item>\n";
|
||||
+ echo '<description><![CDATA['.nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description'])))).$via.$descriptionlink.'[></description>'."\n</item>\n";](></description>'."\n</item>\n";.html)
|
||||
$i++;
|
||||
}
|
||||
echo '</channel></rss><!-- Cached version of '.htmlspecialchars(pageUrl()).' -->';
|
||||
@@ -980,7 +992,7 @@ function showATOM()
|
||||
else $linksToDisplay = $LINKSDB;
|
||||
$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.
|
||||
if (!empty($_GET['nb'])) // In URL, you can specificy the number of links. Example: nb=200 or nb=all for all links.[](.html)
|
||||
- {
|
||||
+ {
|
||||
$nblinksToDisplay = $_GET['nb']=='all' ? count($linksToDisplay) : max($_GET['nb']+0,1) ;
|
||||
$nblinksToDisplay = $_GET['nb']=='all' ? count($linksToDisplay) : max($_GET['nb']+0,1) ;[](.html)
|
||||
}
|
||||
|
||||
@@ -1006,11 +1018,16 @@ function showATOM()
|
||||
|
||||
// Add permalink in description
|
||||
$descriptionlink = htmlspecialchars('(<a href="'.$guid.'">Permalink</a>)');
|
||||
+ if(isset($link['via']) && !empty($link['via'])){
|
||||
+ $via = htmlspecialchars('</br> Origine => <a href="'.$link['via'].'">'.getJustDomain($link['via']).'</a>');
|
||||
+ if(isset($link['via']) && !empty($link['via'])){[](.html)
|
||||
+ $via = htmlspecialchars('</br> Origine => <a href="'.$link['via'].'">'.getJustDomain($link['via']).'</a>');[](.html)
|
||||
+ } else {
|
||||
+ $via = '';
|
||||
+ }
|
||||
// If user wants permalinks first, put the final link in description
|
||||
if ($usepermalinks===true) $descriptionlink = htmlspecialchars('(<a href="'.$absurl.'">Link</a>)');
|
||||
if (strlen($link['description'])>0) $descriptionlink = '<br>'.$descriptionlink;
|
||||
if (strlen($link['description'])>0) $descriptionlink = '<br>'.$descriptionlink;[](.html)
|
||||
|
||||
- $entries.='<content type="html">'.htmlspecialchars(nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description']))))).$descriptionlink."</content>\n";
|
||||
+ $entries.='<content type="html">'.htmlspecialchars(nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description']))))).$descriptionlink.$via."</content>\n";
|
||||
if ($link['tags']!='') // Adding tags to each ATOM entry (as mentioned in ATOM specification)
|
||||
- $entries.='<content type="html">'.htmlspecialchars(nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description']))))).$descriptionlink."</content>\n";[](.html)
|
||||
+ $entries.='<content type="html">'.htmlspecialchars(nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description']))))).$descriptionlink.$via."</content>\n";[](.html)
|
||||
if ($link['tags']!='') // Adding tags to each ATOM entry (as mentioned in ATOM specification)[](.html)
|
||||
{
|
||||
foreach(explode(' ',$link['tags']) as $tag)
|
||||
foreach(explode(' ',$link['tags']) as $tag)[](.html)
|
||||
@@ -1478,7 +1495,7 @@ function renderPage()
|
||||
if (!startsWith($url,'http:') && !startsWith($url,'https:') && !startsWith($url,'ftp:') && !startsWith($url,'magnet:') && !startsWith($url,'?'))
|
||||
$url = 'http://'.$url;
|
||||
$link = array('title'=>trim($_POST['lf_title']),'url'=>$url,'description'=>trim($_POST['lf_description']),'private'=>(isset($_POST['lf_private']) ? 1 : 0),
|
||||
$link = array('title'=>trim($_POST['lf_title']),'url'=>$url,'description'=>trim($_POST['lf_description']),'private'=>(isset($_POST['lf_private']) ? 1 : 0),[](.html)
|
||||
- 'linkdate'=>$linkdate,'tags'=>str_replace(',',' ',$tags));
|
||||
+ 'linkdate'=>$linkdate,'tags'=>str_replace(',',' ',$tags), 'via'=>trim($_POST['lf_via']));
|
||||
if ($link['title']=='') $link['title']=$link['url']; // If title is empty, use the URL as title.
|
||||
$LINKSDB[$linkdate] = $link;
|
||||
+ 'linkdate'=>$linkdate,'tags'=>str_replace(',',' ',$tags), 'via'=>trim($_POST['lf_via']));[](.html)
|
||||
if ($link['title']=='') $link['title']=$link['url']; // If title is empty, use the URL as title.[](.html)
|
||||
$LINKSDB[$linkdate] = $link;[](.html)
|
||||
$LINKSDB->savedb(); // Save to disk.
|
||||
@@ -1556,7 +1573,8 @@ function renderPage()
|
||||
$title = (empty($_GET['title']) ? '' : $_GET['title'] ); // Get title if it was provided in URL (by the bookmarklet).
|
||||
$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
|
||||
+ $via = (empty($_GET['via']) ? '' : $_GET['via'] );
|
||||
+ $private = (!empty($_GET['private']) && $_GET['private'] === "1" ? 1 : 0); // Get private if it was provided in URL
|
||||
$title = (empty($_GET['title']) ? '' : $_GET['title'] ); // Get title if it was provided in URL (by the bookmarklet).[](.html)
|
||||
$description = (empty($_GET['description']) ? '' : $_GET['description']); // Get description if it was provided in URL (by the bookmarklet). [Bronco added that][](.html)
|
||||
$tags = (empty($_GET['tags']) ? '' : $_GET['tags'] ); // Get tags if it was provided in URL[](.html)
|
||||
- $private = (!empty($_GET['private']) && $_GET['private'] === "1" ? 1 : 0); // Get private if it was provided in URL [](.html)
|
||||
+ $via = (empty($_GET['via']) ? '' : $_GET['via'] );[](.html)
|
||||
+ $private = (!empty($_GET['private']) && $_GET['private'] === "1" ? 1 : 0); // Get private if it was provided in URL[](.html)
|
||||
if (($url!='') && parse_url($url,PHP_URL_SCHEME)=='') $url = 'http://'.$url;
|
||||
// If this is an HTTP link, we try go get the page to extract the title (otherwise we will to straight to the edit form.)
|
||||
if (empty($title) && parse_url($url,PHP_URL_SCHEME)=='http')
|
||||
|
@ -130,10 +131,10 @@ index 6fae2f8..53f798e 100644
|
|||
-
|
||||
+
|
||||
// If found, extract encoding.
|
||||
if (!empty($meta[0]))
|
||||
if (!empty($meta[0]))[](.html)
|
||||
{
|
||||
@@ -1577,7 +1595,7 @@ function renderPage()
|
||||
$html_charset = (!empty($enc[1])) ? strtolower($enc[1]) : 'utf-8';
|
||||
$html_charset = (!empty($enc[1])) ? strtolower($enc[1]) : 'utf-8';[](.html)
|
||||
}
|
||||
else { $html_charset = 'utf-8'; }
|
||||
-
|
||||
|
@ -151,13 +152,13 @@ index 6fae2f8..53f798e 100644
|
|||
|
||||
$PAGE = new pageBuilder;
|
||||
@@ -1842,6 +1860,9 @@ function buildLinkList($PAGE,$LINKSDB)
|
||||
$taglist = explode(' ',$link['tags']);
|
||||
$taglist = explode(' ',$link['tags']);[](.html)
|
||||
uasort($taglist, 'strcasecmp');
|
||||
$link['taglist']=$taglist;
|
||||
+ if(!empty($link['via'])){
|
||||
+ $link['via']=htmlspecialchars($link['via']);
|
||||
$link['taglist']=$taglist;[](.html)
|
||||
+ if(!empty($link['via'])){[](.html)
|
||||
+ $link['via']=htmlspecialchars($link['via']);[](.html)
|
||||
+ }
|
||||
$linkDisp[$keys[$i]] = $link;
|
||||
$linkDisp[$keys[$i[ = $link;](-=-$link;.html)
|
||||
$i++;
|
||||
}
|
||||
diff --git a/tpl/editlink.html b/tpl/editlink.html
|
||||
|
@ -169,7 +170,7 @@ index 4a2c30c..14d4f9c 100644
|
|||
<i>Description</i><br><textarea name="lf_description" rows="4" cols="25" style="width:100%">{$link.description|htmlspecialchars}</textarea><br>
|
||||
<i>Tags</i><br><input type="text" id="lf_tags" name="lf_tags" value="{$link.tags|htmlspecialchars}" style="width:100%"><br>
|
||||
+ <i>Origine</i><br><input type="text" name="lf_via" value="{$link.via|htmlspecialchars}" style="width:100%"><br>
|
||||
{if condition="($link_is_new && $GLOBALS['privateLinkByDefault']==true) || $link.private == true"}
|
||||
{if condition="($link_is_new && $GLOBALS['privateLinkByDefault']==true) || $link.private == true"}[](.html)
|
||||
<input type="checkbox" checked="checked" name="lf_private" id="lf_private">
|
||||
<label for="lf_private"><i>Private</i></label><br>
|
||||
diff --git a/tpl/linklist.html b/tpl/linklist.html
|
||||
|
@ -181,9 +182,9 @@ index ddc38cb..0a8475f 100644
|
|||
<br>
|
||||
{if="$value.description"}<div class="linkdescription"{if condition="$search_type=='permalink'"} style="max-height:none !important;"{/if}>{$value.description}</div>{/if}
|
||||
+ {if condition="isset($value.via) && !empty($value.via)"}<div><a href="{$value.via}">Origine => {$value.via|getJustDomain}</a></div>{/if}
|
||||
{if="!$GLOBALS['config']['HIDE_TIMESTAMPS'] || isLoggedIn()"}
|
||||
{if="!$GLOBALS['config'['HIDE_TIMESTAMPS'] || isLoggedIn()"}]('HIDE_TIMESTAMPS']-||-isLoggedIn()"}.html)
|
||||
<span class="linkdate" title="Permalink"><a href="?{$value.linkdate|smallHash}">{$value.localdate|htmlspecialchars} - permalink</a> - </span>
|
||||
{else}
|
||||
--
|
||||
2.1.1
|
||||
```
|
||||
```
|
||||
|
|
97
doc/FAQ.html
Normal file
97
doc/FAQ.html
Normal file
|
@ -0,0 +1,97 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>Shaarli - FAQ</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="faq">FAQ</h1>
|
||||
<h3 id="why-did-you-create-shaarli">Why did you create Shaarli ?</h3>
|
||||
<p>I was a StumbleUpon user. Then I got fed up with they big toolbar. I switched to delicious, which was lighter, faster and more beautiful. Until Yahoo bought it. Then the export API broke all the time, delicious became slow and was ditched by Yahoo. I switched to Diigo, which is not bad, but does too much. And Diigo is sslllooooowww and their Firefox extension a bit buggy. And… oh… <strong>their Firefox addon sends to Diigo every single URL you visit</strong> (Don't believe me ? Use <a href="https://addons.mozilla.org/en-US/firefox/addon/tamper-data/">Tamper Data</a> and open any page).<a href=".html"></a></p>
|
||||
<p>Enough is enough. Saving simple links should not be a complicated heavy thing. I ditched them all and wrote my own: Shaarli. It's simple, but it does the job and does it well. And my data is not hosted on a foreign server, but on my server.</p>
|
||||
<h3 id="why-use-shaarli-and-not-deliciousdiigo">Why use Shaarli and not Delicious/Diigo ?</h3>
|
||||
<p>With Shaarli:</p>
|
||||
<ul>
|
||||
<li>The data is yours: It's hosted on your server.</li>
|
||||
<li>Never fear of having your data locked-in.</li>
|
||||
<li>Never fear to have your data sold to third party.</li>
|
||||
<li>Your private links are not hosted on a third party server.</li>
|
||||
<li>You are not tracked by browser addons (like Diigo does)</li>
|
||||
<li>You can change the look and feel of the pages if you want.</li>
|
||||
<li>You can change the behaviour of the program.</li>
|
||||
<li>It's magnitude faster than most bookmarking services.</li>
|
||||
</ul>
|
||||
<h3 id="what-does-shaarli-mean">What does Shaarli mean?</h3>
|
||||
<p>Shaarli is for shaaring your links.</p>
|
||||
<h3 id="my-shaarli-is-broken">My Shaarli is broken!</h3>
|
||||
<p>First of all, ensure that both the <a href="Server-configuration">web server</a> and <a href="Shaarli-configuration">Shaarli</a> are correctly configured, and that your installation is <a href="Server-requirements">supported</a>.<a href=".html"></a></p>
|
||||
<p>If everything looks right but the issue(s) remain(s), please:</p>
|
||||
<ul>
|
||||
<li>take a look at the <a href="Troubleshooting">troubleshooting</a> section<a href=".html"></a></li>
|
||||
<li>come <a href="https://gitter.im/shaarli/Shaarli">chat with us</a> on Gitter, we'll be happy to help ;-)<a href=".html"></a></li>
|
||||
<li>browse active <a href="https://github.com/shaarli/Shaarli/issues">issues</a> and <a href="https://github.com/shaarli/Shaarli/pulls">Pull Requests</a><a href=".html"></a>
|
||||
<ul>
|
||||
<li>if you find one that is related to the issue, feel free to comment and provide additional details (host/Shaarli setup)</li>
|
||||
<li>else, <a href="https://github.com/shaarli/Shaarli/issues/new">open a new issue</a>, and provide information about the problem:<a href=".html"></a>
|
||||
<ul>
|
||||
<li><em>what happens?</em> - display glitches, invalid data, security flaws...</li>
|
||||
<li><em>what is your configuration?</em> - OS, server version, activated extensions, web browser...</li>
|
||||
<li><em>is it reproducible?</em></li>
|
||||
</ul></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
<h3 id="why-not-use-a-real-database-files-are-slow">Why not use a real database? Files are slow!</h3>
|
||||
<p>Does browsing <a href="http://sebsauvage.net/links/">this page</a> feel slow? Try browsing older pages, too.<a href=".html"></a></p>
|
||||
<p>It's not slow at all, is it? And don't forget the database contains more than 16000 links, and it's on a shared host, with 32000 visitors/day for my website alone. And it's still damn fast. Why?</p>
|
||||
<p>The data file is only 3.7 Mb. It's read 99% of the time, and is probably already in the operation system disk cache. So generating a page involves no I/O at all most of the time.</p>
|
||||
</body>
|
||||
</html>
|
44
doc/FAQ.md
Normal file
44
doc/FAQ.md
Normal file
|
@ -0,0 +1,44 @@
|
|||
#FAQ
|
||||
### Why did you create Shaarli ?
|
||||
|
||||
I was a StumbleUpon user. Then I got fed up with they big toolbar. I switched to delicious, which was lighter, faster and more beautiful. Until Yahoo bought it. Then the export API broke all the time, delicious became slow and was ditched by Yahoo. I switched to Diigo, which is not bad, but does too much. And Diigo is sslllooooowww and their Firefox extension a bit buggy. And… oh… **their Firefox addon sends to Diigo every single URL you visit** (Don't believe me ? Use [Tamper Data](https://addons.mozilla.org/en-US/firefox/addon/tamper-data/) and open any page).[](.html)
|
||||
|
||||
Enough is enough. Saving simple links should not be a complicated heavy thing. I ditched them all and wrote my own: Shaarli. It's simple, but it does the job and does it well. And my data is not hosted on a foreign server, but on my server.
|
||||
|
||||
### Why use Shaarli and not Delicious/Diigo ?
|
||||
|
||||
With Shaarli:
|
||||
|
||||
* The data is yours: It's hosted on your server.
|
||||
* Never fear of having your data locked-in.
|
||||
* Never fear to have your data sold to third party.
|
||||
* Your private links are not hosted on a third party server.
|
||||
* You are not tracked by browser addons (like Diigo does)
|
||||
* You can change the look and feel of the pages if you want.
|
||||
* You can change the behaviour of the program.
|
||||
* It's magnitude faster than most bookmarking services.
|
||||
|
||||
### What does Shaarli mean?
|
||||
|
||||
Shaarli is for shaaring your links.
|
||||
|
||||
### My Shaarli is broken!
|
||||
First of all, ensure that both the [web server](Server-configuration) and [Shaarli](Shaarli-configuration) are correctly configured, and that your installation is [supported](Server-requirements).[](.html)
|
||||
|
||||
If everything looks right but the issue(s) remain(s), please:
|
||||
- take a look at the [troubleshooting](Troubleshooting) section[](.html)
|
||||
- come [chat with us](https://gitter.im/shaarli/Shaarli) on Gitter, we'll be happy to help ;-)[](.html)
|
||||
- browse active [issues](https://github.com/shaarli/Shaarli/issues) and [Pull Requests](https://github.com/shaarli/Shaarli/pulls)[](.html)
|
||||
- if you find one that is related to the issue, feel free to comment and provide additional details (host/Shaarli setup)
|
||||
- else, [open a new issue](https://github.com/shaarli/Shaarli/issues/new), and provide information about the problem:[](.html)
|
||||
- _what happens?_ - display glitches, invalid data, security flaws...
|
||||
- _what is your configuration?_ - OS, server version, activated extensions, web browser...
|
||||
- _is it reproducible?_
|
||||
|
||||
### Why not use a real database? Files are slow!
|
||||
|
||||
Does browsing [this page](http://sebsauvage.net/links/) feel slow? Try browsing older pages, too.[](.html)
|
||||
|
||||
It's not slow at all, is it? And don't forget the database contains more than 16000 links, and it's on a shared host, with 32000 visitors/day for my website alone. And it's still damn fast. Why?
|
||||
|
||||
The data file is only 3.7 Mb. It's read 99% of the time, and is probably already in the operation system disk cache. So generating a page involves no I/O at all most of the time.
|
72
doc/Firefox-share.html
Normal file
72
doc/Firefox-share.html
Normal file
|
@ -0,0 +1,72 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>Shaarli - Firefox share</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="firefox-share">Firefox share</h1>
|
||||
<h3 id="add-shaarli-as-a-sharing-service-to-firefox">Add Shaarli as a sharing service to Firefox</h3>
|
||||
<ul>
|
||||
<li>Open your Shaarli and <code>Login</code></li>
|
||||
<li>Click the <code>Tools</code> button in the top bar</li>
|
||||
<li>Click the <code>✚Add to Firefox social</code> button and accept the activation.</li>
|
||||
</ul>
|
||||
<h3 id="sharing-links-using-firefox-share">Sharing links using Firefox share</h3>
|
||||
<ul>
|
||||
<li>Add the sharing service as described above</li>
|
||||
<li>When you are visiting a webpage you would like to share with Shaarli, click the Firefox <em>Share</em> button <a href="images/firefoxshare.png.html">images/firefoxshare.png</a></li>
|
||||
<li>You can edit your link before and after saving, just like the bookmarklet above.</li>
|
||||
</ul>
|
||||
<p>| | Your Shaarli instance must be hosted on an HTTPS (SSL/TLS secure connection) enabled server for Firefox Share to work. Firefox Share will not work over plain HTTP connections. |<br />|------|-------------------------------------------------------------------------------|</p>
|
||||
</body>
|
||||
</html>
|
16
doc/Firefox-share.md
Normal file
16
doc/Firefox-share.md
Normal file
|
@ -0,0 +1,16 @@
|
|||
#Firefox share
|
||||
### Add Shaarli as a sharing service to Firefox
|
||||
|
||||
* Open your Shaarli and `Login`
|
||||
* Click the `Tools` button in the top bar
|
||||
* Click the `✚Add to Firefox social` button and accept the activation.
|
||||
|
||||
|
||||
### Sharing links using Firefox share
|
||||
|
||||
* Add the sharing service as described above
|
||||
* When you are visiting a webpage you would like to share with Shaarli, click the Firefox _Share_ button [images/firefoxshare.png](images/firefoxshare.png.html)
|
||||
* You can edit your link before and after saving, just like the bookmarklet above.
|
||||
|
||||
| | Your Shaarli instance must be hosted on an HTTPS (SSL/TLS secure connection) enabled server for Firefox Share to work. Firefox Share will not work over plain HTTP connections. |
|
||||
|------|-------------------------------------------------------------------------------|
|
199
doc/GnuPG-signature.html
Normal file
199
doc/GnuPG-signature.html
Normal file
|
@ -0,0 +1,199 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>Shaarli - GnuPG signature</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<style type="text/css">
|
||||
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
|
||||
margin: 0; padding: 0; vertical-align: baseline; border: none; }
|
||||
table.sourceCode { width: 100%; line-height: 100%; }
|
||||
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
|
||||
td.sourceCode { padding-left: 5px; }
|
||||
code > span.kw { color: #007020; font-weight: bold; }
|
||||
code > span.dt { color: #902000; }
|
||||
code > span.dv { color: #40a070; }
|
||||
code > span.bn { color: #40a070; }
|
||||
code > span.fl { color: #40a070; }
|
||||
code > span.ch { color: #4070a0; }
|
||||
code > span.st { color: #4070a0; }
|
||||
code > span.co { color: #60a0b0; font-style: italic; }
|
||||
code > span.ot { color: #007020; }
|
||||
code > span.al { color: #ff0000; font-weight: bold; }
|
||||
code > span.fu { color: #06287e; }
|
||||
code > span.er { color: #ff0000; font-weight: bold; }
|
||||
</style>
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="gnupg-signature">GnuPG signature</h1>
|
||||
<h2 id="introduction">Introduction</h2>
|
||||
<h3 id="pgp-and-gpg">PGP and GPG</h3>
|
||||
<p><a href="https://gnupg.org/">Gnu Privacy Guard</a> (GnuPG) is an Open Source implementation of the <a href="https://en.wikipedia.org/wiki/Pretty_Good_Privacy#OpenPGP">Pretty Good [](.html)<br />Privacy</a> (OpenPGP) specification. Its main purposes are digital authentication,<br />signature and encryption.</p>
|
||||
<p>It is often used by the <a href="https://en.wikipedia.org/wiki/Free_and_open-source_software">FLOSS</a> community to verify:<a href=".html"></a></p>
|
||||
<ul>
|
||||
<li>Linux package signatures: Debian <a href="https://wiki.debian.org/SecureApt">SecureApt</a>, ArchLinux <a href="https://www.archlinux.org/master-keys/">Master [](.html)<br />Keys</a></li>
|
||||
<li><a href="https://en.wikipedia.org/wiki/Revision_control">SCM</a> releases & maintainer identity<a href=".html"></a></li>
|
||||
</ul>
|
||||
<h3 id="trust">Trust</h3>
|
||||
<p>To quote Phil Pennock (the author of the <a href="https://bitbucket.org/skskeyserver/sks-keyserver/wiki/Home">SKS</a> key server - <a href="http://sks.spodhuis.org/" class="uri">http://sks.spodhuis.org/</a>):<a href=".html"></a></p>
|
||||
<blockquote>
|
||||
<p>You MUST understand that presence of data in the keyserver (pools) in no way connotes trust. Anyone can generate a key, with any name or email address, and upload it. All security and trust comes from evaluating security at the “object level”, via PGP Web-Of-Trust signatures. This keyserver makes it possible to retrieve keys, looking them up via various indices, but the collection of keys in this public pool is KNOWN to contain malicious and fraudulent keys. It is the common expectation of server operators that users understand this and use software which, like all known common OpenPGP implementations, evaluates trust accordingly. This expectation is so common that it is not normally explicitly stated.</p>
|
||||
</blockquote>
|
||||
<p>Trust can be gained by having your key signed by other people (and signing their key back, too :) ), for instance during <a href="https://en.wikipedia.org/wiki/Key_signing_party">key signing parties</a>, see:<a href=".html"></a></p>
|
||||
<ul>
|
||||
<li><a href="http://www.cryptnet.net/fdp/crypto/keysigning_party/en/keysigning_party.html">The Keysigning party HOWTO</a><a href=".html"></a></li>
|
||||
<li><a href="https://en.wikipedia.org/wiki/Web_of_trust">Web of trust</a><a href=".html"></a></li>
|
||||
</ul>
|
||||
<h2 id="generate-a-gpg-key">Generate a GPG key</h2>
|
||||
<p>See <a href="http://stackoverflow.com/a/16725717">Generating a GPG key for Git tagging</a>.<a href=".html"></a></p>
|
||||
<h3 id="gpg---provide-identity-information">gpg - provide identity information</h3>
|
||||
<pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="kw">gpg</span> --gen-key
|
||||
|
||||
<span class="kw">gpg</span> (GnuPG) <span class="kw">2.1.6;</span> <span class="kw">Copyright</span> (C) <span class="kw">2015</span> Free Software Foundation, Inc.
|
||||
<span class="kw">This</span> is free software: you are free to change and redistribute it.
|
||||
<span class="kw">There</span> is NO WARRANTY, to the extent permitted by law.
|
||||
|
||||
<span class="kw">Note</span>: Use <span class="st">"gpg2 --full-gen-key"</span> for a full featured key generation dialog.
|
||||
|
||||
<span class="kw">GnuPG</span> needs to construct a user ID to identify your key.
|
||||
|
||||
<span class="kw">Real</span> name: Marvin the Paranoid Android
|
||||
<span class="kw">Email</span> address: marvin@h2g2.net
|
||||
<span class="kw">You</span> selected this USER-ID:
|
||||
<span class="st">"Marvin the Paranoid Android <marvin@h2g2.net>"</span>
|
||||
|
||||
<span class="kw">Change</span> (N)<span class="kw">ame</span>, (E)<span class="kw">mail</span>, or (O)<span class="kw">kay</span>/<span class="kw">(Q)uit?</span> o
|
||||
<span class="kw">We</span> need to generate a lot of random bytes. It is a good idea to perform
|
||||
<span class="kw">some</span> other action (type on the keyboard, move the mouse, utilize the
|
||||
<span class="kw">disks</span>) <span class="kw">during</span> the prime generation<span class="kw">;</span> <span class="kw">this</span> gives the random number
|
||||
<span class="kw">generator</span> a better chance to gain enough entropy.</code></pre>
|
||||
<h3 id="gpg---entropy-interlude">gpg - entropy interlude</h3>
|
||||
<p>At this point, you will:</p>
|
||||
<ul>
|
||||
<li>be prompted for a secure password to protect your key (the input method will depend on your Desktop Environment and configuration)</li>
|
||||
<li>be asked to use your machine's input devices (mouse, keyboard, etc.) to generate random entropy; this step <em>may take some time</em></li>
|
||||
</ul>
|
||||
<h3 id="gpg---key-creation-confirmation">gpg - key creation confirmation</h3>
|
||||
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">gpg</span>: key A9D53A3E marked as ultimately trusted
|
||||
<span class="kw">public</span> and secret key created and signed.
|
||||
|
||||
<span class="kw">gpg</span>: checking the trustdb
|
||||
<span class="kw">gpg</span>: 3 marginal(s) <span class="kw">needed</span>, 1 complete(s) <span class="kw">needed</span>, PGP trust model
|
||||
<span class="kw">gpg</span>: depth: 0 valid: 2 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 2u
|
||||
<span class="kw">pub</span> rsa2048/A9D53A3E 2015-07-31
|
||||
<span class="kw">Key</span> fingerprint = AF2A 5381 E54B 2FD2 14C4 A9A3 0E35 ACA4 A9D5 3A3E
|
||||
<span class="kw">uid</span> [ultimate] Marvin the Paranoid Android <span class="kw"><</span>marvin@h2g2.net<span class="kw">></span>[](.html)
|
||||
<span class="kw">sub</span> rsa2048/8C0EACF1 2015-07-31</code></pre>
|
||||
<h3 id="gpg---submit-your-public-key-to-a-pgp-server-optional">gpg - submit your public key to a PGP server (Optional)</h3>
|
||||
<pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="kw">gpg</span> --keyserver pgp.mit.edu --send-keys A9D53A3E
|
||||
<span class="kw">gpg</span>: sending key A9D53A3E to hkp server pgp.mit.edu</code></pre>
|
||||
<h2 id="create-and-push-a-gpg-signed-tag">Create and push a GPG-signed tag</h2>
|
||||
<p>See <a href="http://git-scm.com/book/en/v2/Distributed-Git-Maintaining-a-Project#Tagging-Your-Releases">Git - Maintaining a project - Tagging your [](.html)<br />releases</a>.</p>
|
||||
<h3 id="prerequisites">Prerequisites</h3>
|
||||
<p>This guide assumes that you have:</p>
|
||||
<ul>
|
||||
<li>a GPG key matching your GitHub authentication credentials
|
||||
<ul>
|
||||
<li>i.e., the email address identified by the GPG key is the same as the one in your <code>~/.gitconfig</code></li>
|
||||
</ul></li>
|
||||
<li>a GitHub fork of Shaarli</li>
|
||||
<li>a local clone of your Shaarli fork, with the following remotes:
|
||||
<ul>
|
||||
<li><code>origin</code> pointing to your GitHub fork</li>
|
||||
<li><code>upstream</code> pointing to the main Shaarli repository</li>
|
||||
</ul></li>
|
||||
<li>maintainer permissions on the main Shaarli repository (to push the signed tag)</li>
|
||||
</ul>
|
||||
<h3 id="bump-shaarlis-version">Bump Shaarli's version</h3>
|
||||
<pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="kw">cd</span> /path/to/shaarli
|
||||
|
||||
<span class="co"># create a new branch</span>
|
||||
$ <span class="kw">git</span> fetch upstream
|
||||
$ <span class="kw">git</span> checkout upstream/master -b v0.5.0
|
||||
|
||||
<span class="co"># bump the version number</span>
|
||||
$ <span class="kw">vim</span> index.php shaarli_version.php
|
||||
|
||||
<span class="co"># commit the changes</span>
|
||||
$ <span class="kw">git</span> add index.php shaarli_version.php
|
||||
$ <span class="kw">git</span> commit -s -m <span class="st">"Bump version to v0.5.0"</span>
|
||||
|
||||
<span class="co"># push the commit on your GitHub fork</span>
|
||||
$ <span class="kw">git</span> push origin v0.5.0</code></pre>
|
||||
<h3 id="create-and-merge-a-pull-request">Create and merge a Pull Request</h3>
|
||||
<p>This one is pretty straightforward ;-)</p>
|
||||
<h3 id="create-and-push-a-signed-tag">Create and push a signed tag</h3>
|
||||
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="co"># update your local copy</span>
|
||||
$ <span class="kw">git</span> checkout master
|
||||
$ <span class="kw">git</span> fetch upstream
|
||||
$ <span class="kw">git</span> pull upstream master
|
||||
|
||||
<span class="co"># create a signed tag</span>
|
||||
$ <span class="kw">git</span> tag -s -m <span class="st">"Release v0.5.0"</span> v0.5.0
|
||||
|
||||
<span class="co"># push it to "upstream"</span>
|
||||
$ <span class="kw">git</span> push --tags upstream</code></pre>
|
||||
<h3 id="verify-a-signed-tag">Verify a signed tag</h3>
|
||||
<p><a href="https://github.com/shaarli/Shaarli/releases/tag/v0.5.0"><code>v0.5.0</code></a> is the first GPG-signed tag pushed on the Community Shaarli.<a href=".html"></a></p>
|
||||
<p>Let's have a look at its signature!</p>
|
||||
<pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="kw">cd</span> /path/to/shaarli
|
||||
$ <span class="kw">git</span> fetch upstream
|
||||
|
||||
<span class="co"># get the SHA1 reference of the tag</span>
|
||||
$ <span class="kw">git</span> show-ref tags/v0.5.0
|
||||
<span class="kw">f7762cf803f03f5caf4b8078359a63783d0090c1</span> refs/tags/v0.5.0
|
||||
|
||||
<span class="co"># verify the tag signature information</span>
|
||||
$ <span class="kw">git</span> verify-tag f7762cf803f03f5caf4b8078359a63783d0090c1
|
||||
<span class="kw">gpg</span>: Signature made Thu 30 Jul 2015 11:46:34 CEST using RSA key ID 4100DF6F
|
||||
<span class="kw">gpg</span>: Good signature from <span class="st">"VirtualTam <virtualtam@flibidi.net>"</span> [ultimate][](.html)</code></pre>
|
||||
</body>
|
||||
</html>
|
141
doc/GnuPG-signature.md
Normal file
141
doc/GnuPG-signature.md
Normal file
|
@ -0,0 +1,141 @@
|
|||
#GnuPG signature
|
||||
## Introduction
|
||||
### PGP and GPG
|
||||
[Gnu Privacy Guard](https://gnupg.org/) (GnuPG) is an Open Source implementation of the [Pretty Good [](.html)
|
||||
Privacy](https://en.wikipedia.org/wiki/Pretty_Good_Privacy#OpenPGP) (OpenPGP) specification. Its main purposes are digital authentication,
|
||||
signature and encryption.
|
||||
|
||||
It is often used by the [FLOSS](https://en.wikipedia.org/wiki/Free_and_open-source_software) community to verify:[](.html)
|
||||
- Linux package signatures: Debian [SecureApt](https://wiki.debian.org/SecureApt), ArchLinux [Master [](.html)
|
||||
Keys](https://www.archlinux.org/master-keys/)
|
||||
- [SCM](https://en.wikipedia.org/wiki/Revision_control) releases & maintainer identity[](.html)
|
||||
|
||||
### Trust
|
||||
To quote Phil Pennock (the author of the [SKS](https://bitbucket.org/skskeyserver/sks-keyserver/wiki/Home) key server - http://sks.spodhuis.org/):[](.html)
|
||||
|
||||
> You MUST understand that presence of data in the keyserver (pools) in no way connotes trust. Anyone can generate a key, with any name or email address, and upload it. All security and trust comes from evaluating security at the “object level”, via PGP Web-Of-Trust signatures. This keyserver makes it possible to retrieve keys, looking them up via various indices, but the collection of keys in this public pool is KNOWN to contain malicious and fraudulent keys. It is the common expectation of server operators that users understand this and use software which, like all known common OpenPGP implementations, evaluates trust accordingly. This expectation is so common that it is not normally explicitly stated.
|
||||
|
||||
Trust can be gained by having your key signed by other people (and signing their key back, too :) ), for instance during [key signing parties](https://en.wikipedia.org/wiki/Key_signing_party), see:[](.html)
|
||||
- [The Keysigning party HOWTO](http://www.cryptnet.net/fdp/crypto/keysigning_party/en/keysigning_party.html)[](.html)
|
||||
- [Web of trust](https://en.wikipedia.org/wiki/Web_of_trust)[](.html)
|
||||
|
||||
## Generate a GPG key
|
||||
See [Generating a GPG key for Git tagging](http://stackoverflow.com/a/16725717).[](.html)
|
||||
|
||||
### gpg - provide identity information
|
||||
```bash
|
||||
$ gpg --gen-key
|
||||
|
||||
gpg (GnuPG) 2.1.6; Copyright (C) 2015 Free Software Foundation, Inc.
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law.
|
||||
|
||||
Note: Use "gpg2 --full-gen-key" for a full featured key generation dialog.
|
||||
|
||||
GnuPG needs to construct a user ID to identify your key.
|
||||
|
||||
Real name: Marvin the Paranoid Android
|
||||
Email address: marvin@h2g2.net
|
||||
You selected this USER-ID:
|
||||
"Marvin the Paranoid Android <marvin@h2g2.net>"
|
||||
|
||||
Change (N)ame, (E)mail, or (O)kay/(Q)uit? o
|
||||
We need to generate a lot of random bytes. It is a good idea to perform
|
||||
some other action (type on the keyboard, move the mouse, utilize the
|
||||
disks) during the prime generation; this gives the random number
|
||||
generator a better chance to gain enough entropy.
|
||||
```
|
||||
|
||||
### gpg - entropy interlude
|
||||
At this point, you will:
|
||||
- be prompted for a secure password to protect your key (the input method will depend on your Desktop Environment and configuration)
|
||||
- be asked to use your machine's input devices (mouse, keyboard, etc.) to generate random entropy; this step _may take some time_
|
||||
|
||||
### gpg - key creation confirmation
|
||||
```bash
|
||||
gpg: key A9D53A3E marked as ultimately trusted
|
||||
public and secret key created and signed.
|
||||
|
||||
gpg: checking the trustdb
|
||||
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
|
||||
gpg: depth: 0 valid: 2 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 2u
|
||||
pub rsa2048/A9D53A3E 2015-07-31
|
||||
Key fingerprint = AF2A 5381 E54B 2FD2 14C4 A9A3 0E35 ACA4 A9D5 3A3E
|
||||
uid [ultimate] Marvin the Paranoid Android <marvin@h2g2.net>[](.html)
|
||||
sub rsa2048/8C0EACF1 2015-07-31
|
||||
```
|
||||
|
||||
### gpg - submit your public key to a PGP server (Optional)
|
||||
``` bash
|
||||
$ gpg --keyserver pgp.mit.edu --send-keys A9D53A3E
|
||||
gpg: sending key A9D53A3E to hkp server pgp.mit.edu
|
||||
```
|
||||
|
||||
## Create and push a GPG-signed tag
|
||||
See [Git - Maintaining a project - Tagging your [](.html)
|
||||
releases](http://git-scm.com/book/en/v2/Distributed-Git-Maintaining-a-Project#Tagging-Your-Releases).
|
||||
|
||||
### Prerequisites
|
||||
This guide assumes that you have:
|
||||
- a GPG key matching your GitHub authentication credentials
|
||||
- i.e., the email address identified by the GPG key is the same as the one in your `~/.gitconfig`
|
||||
- a GitHub fork of Shaarli
|
||||
- a local clone of your Shaarli fork, with the following remotes:
|
||||
- `origin` pointing to your GitHub fork
|
||||
- `upstream` pointing to the main Shaarli repository
|
||||
- maintainer permissions on the main Shaarli repository (to push the signed tag)
|
||||
|
||||
### Bump Shaarli's version
|
||||
```bash
|
||||
$ cd /path/to/shaarli
|
||||
|
||||
# create a new branch
|
||||
$ git fetch upstream
|
||||
$ git checkout upstream/master -b v0.5.0
|
||||
|
||||
# bump the version number
|
||||
$ vim index.php shaarli_version.php
|
||||
|
||||
# commit the changes
|
||||
$ git add index.php shaarli_version.php
|
||||
$ git commit -s -m "Bump version to v0.5.0"
|
||||
|
||||
# push the commit on your GitHub fork
|
||||
$ git push origin v0.5.0
|
||||
```
|
||||
|
||||
### Create and merge a Pull Request
|
||||
This one is pretty straightforward ;-)
|
||||
|
||||
### Create and push a signed tag
|
||||
```bash
|
||||
# update your local copy
|
||||
$ git checkout master
|
||||
$ git fetch upstream
|
||||
$ git pull upstream master
|
||||
|
||||
# create a signed tag
|
||||
$ git tag -s -m "Release v0.5.0" v0.5.0
|
||||
|
||||
# push it to "upstream"
|
||||
$ git push --tags upstream
|
||||
```
|
||||
|
||||
### Verify a signed tag
|
||||
[`v0.5.0`](https://github.com/shaarli/Shaarli/releases/tag/v0.5.0) is the first GPG-signed tag pushed on the Community Shaarli.[](.html)
|
||||
|
||||
Let's have a look at its signature!
|
||||
|
||||
```bash
|
||||
$ cd /path/to/shaarli
|
||||
$ git fetch upstream
|
||||
|
||||
# get the SHA1 reference of the tag
|
||||
$ git show-ref tags/v0.5.0
|
||||
f7762cf803f03f5caf4b8078359a63783d0090c1 refs/tags/v0.5.0
|
||||
|
||||
# verify the tag signature information
|
||||
$ git verify-tag f7762cf803f03f5caf4b8078359a63783d0090c1
|
||||
gpg: Signature made Thu 30 Jul 2015 11:46:34 CEST using RSA key ID 4100DF6F
|
||||
gpg: Good signature from "VirtualTam <virtualtam@flibidi.net>" [ultimate][](.html)
|
||||
```
|
449
doc/Home.html
449
doc/Home.html
|
@ -4,7 +4,7 @@
|
|||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title></title>
|
||||
<title>Shaarli - Home</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
|
@ -12,404 +12,55 @@
|
|||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="home">Home</h1>
|
||||
<h1 id="shaarli-wiki">Shaarli wiki</h1>
|
||||
<p>Welcome to the <a href="https://github.com/shaarli/Shaarli/">Shaarli</a> wiki! Here you can find some info on how to use, configure, tweak and solve problems with your Shaarli. For general info, read the <a href="https://github.com/shaarli/Shaarli/blob/master/README.md">README</a>.</p>
|
||||
<p>If you have any questions or ideas, please join the <a href="https://gitter.im/shaarli/Shaarli">chat</a> (also reachable via <a href="https://irc.gitter.im/">IRC</a>), post them in our <a href="https://github.com/shaarli/Shaarli/issues/44">general discussion</a> or read the current <a href="https://github.com/shaarli/Shaarli/issues">issues</a>. If you've found a bug, please create a <a href="https://github.com/shaarli/Shaarli/issues/new">new issue</a>. If you would like a feature added to Shaarli, check the issues labeled <a href="https://github.com/shaarli/Shaarli/labels/feature"><code>feature</code></a>, <a href="https://github.com/shaarli/Shaarli/labels/enhancement"><code>enhancement</code></a>, and <a href="https://github.com/shaarli/Shaarli/labels/plugin"><code>plugin</code></a>.</p>
|
||||
<p><em>Note: This documentation is available online at <a href="https://github.com/shaarli/Shaarli/wiki">https://github.com/shaarli/Shaarli/wiki</a>, and locally in the <code>doc/</code> directory of your Shaarli installation.</em></p>
|
||||
<hr />
|
||||
<!-- MarkdownTOC depth=3 -->
|
||||
|
||||
|
||||
<ul>
|
||||
<li><p><a href="#basic-usage">Basic Usage</a></p>
|
||||
<ul>
|
||||
<li><a href="#add-the-sharing-button-_bookmarklet_-to-your-browser">Add the sharing button (<em>bookmarklet</em>) to your browser</a><br /></li>
|
||||
<li><a href="#add-shaarli-as-a-sharing-service-to-firefox">Add Shaarli as a sharing service to Firefox</a><br /></li>
|
||||
<li><a href="#share-links-using-the-_bookmarklet_">Share links using the <em>bookmarklet</em></a><br /></li>
|
||||
<li><a href="#sharing-links-using-firefox-share">Sharing links using Firefox share</a><br /></li>
|
||||
</ul></li>
|
||||
<li><p><a href="#other-usage-examples">Other usage examples</a></p>
|
||||
<ul>
|
||||
<li><a href="#using-shaarli-as-a-blog-notepad-pastebin">Using Shaarli as a blog, notepad, pastebin...</a><br /></li>
|
||||
<li><a href="#rss-feeds-or-picture-wall-for-a-specific-searchtag">RSS Feeds or Picture Wall for a specific search/tag</a><br /></li>
|
||||
</ul></li>
|
||||
<li><p><a href="#configuration">Configuration</a></p>
|
||||
<ul>
|
||||
<li><a href="#main-dataoptionsphp-file">Main data/options.php file</a><br /></li>
|
||||
<li><a href="#changing-theme">Changing theme</a><br /></li>
|
||||
<li><a href="#changing-template">Changing template</a><br /></li>
|
||||
</ul></li>
|
||||
<li><a href="#backup">Backup</a><br /></li>
|
||||
<li><p><a href="#troubleshooting">Troubleshooting</a></p>
|
||||
<ul>
|
||||
<li><a href="#i-forgot-my-password-">I forgot my password !</a><br /></li>
|
||||
<li><a href="#im-locked-out---login-bruteforce-protection">I'm locked out - Login bruteforce protection</a><br /></li>
|
||||
<li><a href="#list-of-all-login-attempts">List of all login attempts</a><br /></li>
|
||||
<li><a href="#exporting-from-diigo">Exporting from Diigo</a><br /></li>
|
||||
<li><a href="#importing-from-semanticscuttle">Importing from SemanticScuttle</a><br /></li>
|
||||
<li><a href="#importing-from-mister-wong">Importing from Mister Wong</a><br /></li>
|
||||
<li><a href="#hosting-problems">Hosting problems</a><br /></li>
|
||||
<li><a href="#dates-are-not-properly-formatted">Dates are not properly formatted</a><br /></li>
|
||||
<li><a href="#problems-on-centos-servers">Problems on CentOS servers</a><br /></li>
|
||||
<li><a href="#my-session-expires--i-cant-stay-logged-in">My session expires ! I can't stay logged in</a><br /></li>
|
||||
<li><a href="#sessions-do-not-seem-to-work-correctly-on-your-server"><code>Sessions do not seem to work correctly on your server</code></a><br /></li>
|
||||
<li><a href="#pubsubhubbub-support">pubsubhubbub support</a><br /></li>
|
||||
</ul></li>
|
||||
<li><p><a href="#notes">Notes</a></p>
|
||||
<ul>
|
||||
<li><a href="#various-hacks">Various hacks</a><br /></li>
|
||||
<li><a href="#changing-timestamp-for-a-link">Changing timestamp for a link</a><br /></li>
|
||||
</ul></li>
|
||||
<li><p><a href="#related-software">Related software</a></p>
|
||||
<ul>
|
||||
<li><a href="#server-apps">Server apps</a><br /></li>
|
||||
<li><a href="#android-apps">Android apps</a><br /></li>
|
||||
<li><a href="#themes--templates">Themes & templates</a><br /></li>
|
||||
<li><a href="#integrate-shaarli-with-other-platforms">Integrate Shaarli with other platforms</a><br /></li>
|
||||
<li><a href="#alternative-to-shaarli">Alternative to Shaarli</a><br /></li>
|
||||
</ul></li>
|
||||
<li><a href="#other-links">Other links</a><br /></li>
|
||||
<li><p><a href="#faq">FAQ</a></p>
|
||||
<ul>
|
||||
<li><a href="#why-did-you-create-shaarli-">Why did you create Shaarli ?</a><br /></li>
|
||||
<li><a href="#why-use-shaarli-and-not-deliciousdiigo-">Why use Shaarli and not Delicious/Diigo ?</a><br /></li>
|
||||
<li><a href="#what-does-shaarli-mean-">What does Shaarli mean ?</a><br /></li>
|
||||
</ul></li>
|
||||
<li><p><a href="#technical-details">Technical details</a></p>
|
||||
<ul>
|
||||
<li><a href="#directory-structure">Directory structure</a><br /></li>
|
||||
<li><a href="#development">Development</a><br /></li>
|
||||
<li><a href="#why-not-use-a-real-database--files-are-slow-">Why not use a real database ? Files are slow !</a><br /></li>
|
||||
</ul></li>
|
||||
<li><p><a href="#wiki---todo">Wiki - TODO</a></p></li>
|
||||
</ul>
|
||||
<!-- /MarkdownTOC -->
|
||||
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
<h1 id="basic-usage">Basic Usage</h1>
|
||||
<h3 id="add-the-sharing-button-bookmarklet-to-your-browser">Add the sharing button (<em>bookmarklet</em>) to your browser</h3>
|
||||
<ul>
|
||||
<li>Open your Shaarli and <code>Login</code><br /></li>
|
||||
<li>Click the <code>Tools</code> button in the top bar<br /></li>
|
||||
<li>Drag the <strong><code>✚Shaare link</code> button</strong>, and drop it to your browser's bookmarks bar.</li>
|
||||
</ul>
|
||||
<p><em>This bookmarklet button in compatible with Firefox, Opera, Chrome and Safari. Under Opera, you can't drag'n drop the button: You have to right-click on it and add a bookmark to your personal toolbar.</em></p>
|
||||
<p><img src="images/bookmarklet.png" /></p>
|
||||
<h3 id="add-shaarli-as-a-sharing-service-to-firefox">Add Shaarli as a sharing service to Firefox</h3>
|
||||
<ul>
|
||||
<li>Open your Shaarli and <code>Login</code><br /></li>
|
||||
<li>Click the <code>Tools</code> button in the top bar<br /></li>
|
||||
<li>Click the <code>✚Add to Firefox social</code> button and accept the activation.</li>
|
||||
</ul>
|
||||
<h3 id="share-links-using-the-bookmarklet">Share links using the <em>bookmarklet</em></h3>
|
||||
<ul>
|
||||
<li>When you are visiting a webpage you would like to share with Shaarli, click the <em>bookmarklet</em> you just added.<br /></li>
|
||||
<li>A window opens.<br /></li>
|
||||
<li>You can freely edit title, description, tags... to find it later using the text search or tag filtering.<br /></li>
|
||||
<li>You will be able to edit this link later using the <img src="https://raw.githubusercontent.com/shaarli/Shaarli/master/images/edit_icon.png" /> edit button.<br /></li>
|
||||
<li>You can also check the “Private” box so that the link is saved but only visible to you.<br /></li>
|
||||
<li>Click <code>Save</code>.<strong>Voila! Your link is now shared.</strong></li>
|
||||
</ul>
|
||||
<h3 id="sharing-links-using-firefox-share">Sharing links using Firefox share</h3>
|
||||
<ul>
|
||||
<li>Add the sharing service as described above<br /></li>
|
||||
<li>When you are visiting a webpage you would like to share with Shaarli, click the Firefox <em>Share</em> button [[images/firefoxshare.png]]<br /></li>
|
||||
<li>You can edit your link before and after saving, just like the bookmarklet above.</li>
|
||||
</ul>
|
||||
<h1 id="other-usage-examples">Other usage examples</h1>
|
||||
<p>Shaarli can be used:</p>
|
||||
<ul>
|
||||
<li>to share, comment and save interesting links and news<br /></li>
|
||||
<li>to bookmark useful/frequent personal links (as private links) and share them between computers<br /></li>
|
||||
<li>as a minimal blog/microblog/writing platform (no character limit)<br /></li>
|
||||
<li>as a read-it-later list (for example items tagged <code>readlater</code>)<br /></li>
|
||||
<li>to draft and save articles/ideas<br /></li>
|
||||
<li>to keep code snippets<br /></li>
|
||||
<li>to keep notes and documentation<br /></li>
|
||||
<li>as a shared clipboard between machines<br /></li>
|
||||
<li>as a todo list<br /></li>
|
||||
<li>to store playlists (e.g. with the <code>music</code> or <code>video</code> tags)<br /></li>
|
||||
<li>to keep extracts/comments from webpages that may disappear<br /></li>
|
||||
<li>to keep track of ongoing discussions (for example items tagged <code>discussion</code>)<br /></li>
|
||||
<li><a href="http://shaarli.chassegnouf.net/?9Efeiw">to feed RSS aggregators</a> (planets) with specific tags<br /></li>
|
||||
<li>to feed other social networks, blogs... using RSS feeds and external services (dlvr.it, ifttt.com ...)</li>
|
||||
</ul>
|
||||
<h3 id="using-shaarli-as-a-blog-notepad-pastebin...">Using Shaarli as a blog, notepad, pastebin...</h3>
|
||||
<ul>
|
||||
<li>Go to your Shaarli setup and log in<br /></li>
|
||||
<li>Click the <code>Add Link</code> button<br /></li>
|
||||
<li>To share text only, do not enter any URL in the corresponding input field and click <code>Add Link</code><br /></li>
|
||||
<li>Pick a title and enter your article, or note, in the description field; add a few tags; optionally check <code>Private</code> then click <code>Save</code><br /></li>
|
||||
<li>Voilà! Your article is now published (privately if you selected that option) and accessible using its permalink.</li>
|
||||
</ul>
|
||||
<h3 id="rss-feeds-or-picture-wall-for-a-specific-searchtag">RSS Feeds or Picture Wall for a specific search/tag</h3>
|
||||
<p>It is possible to filter RSS/ATOM feeds and Picture Wall on a Shaarli to <strong>only display results of a specific search, or for a specific tag</strong>. For example, if you want to subscribe only to links tagged <code>photography</code>:</p>
|
||||
<ul>
|
||||
<li>Go to the desired Shaarli instance.<br /></li>
|
||||
<li>Search for the <code>photography</code> tag in the <em>Filter by tag</em> box. Links tagged <code>photography</code> are displayed.<br /></li>
|
||||
<li>Click on the <code>RSS Feed</code> button.<br /></li>
|
||||
<li>You are presented with an RSS feed showing only these links. Subscribe to it to receive only updates with this tag.<br /></li>
|
||||
<li>The same method <strong>also works for a full-text search</strong> (<em>Search</em> box) <strong>and for the Picture Wall</strong> (want to only see pictures about <code>nature</code>?)<br /></li>
|
||||
<li>You can also build the URL manually: <code>https://my.shaarli.domain/?do=rss&searchtags=nature</code>, <code>https://my.shaarli.domain/links/?do=picwall&searchterm=poney</code></li>
|
||||
</ul>
|
||||
<p><img src="images/rss-filter-1.png" /> <img src="images/rss-filter-2.png" /></p>
|
||||
<h1 id="configuration">Configuration</h1>
|
||||
<h3 id="main-dataoptions.php-file">Main data/options.php file</h3>
|
||||
<p>To change the configuration, create the file <code>data/options.php</code>, example:</p>
|
||||
<pre><code> <?php
|
||||
$GLOBALS['config']['LINKS_PER_PAGE'] = 30;
|
||||
$GLOBALS['config']['HIDE_TIMESTAMPS'] = true;
|
||||
$GLOBALS['config']['ENABLE_THUMBNAILS'] = false;
|
||||
?></code></pre>
|
||||
<p><strong>Do not edit config options in index.php! Your changes would be lost when you upgrade.</strong> The following parameters are available (parameters (default value)):</p>
|
||||
<ul>
|
||||
<li><code>DATADIR ('data')</code> : This is the name of the subdirectory where Shaarli stores is data file. You can change it for better security.<br /></li>
|
||||
<li><code>CONFIG_FILE ($GLOBALS['config']['DATADIR'].'/config.php')</code> : Name of file which is used to store login/password.<br /></li>
|
||||
<li><code>DATASTORE ($GLOBALS['config']['DATADIR'].'/datastore.php')</code> : Name of file which contains the link database.<br /></li>
|
||||
<li><code>LINKS_PER_PAGE (20)</code> : Default number of links per page displayed.<br /></li>
|
||||
<li><code>IPBANS_FILENAME ($GLOBALS['config']['DATADIR'].'/ipbans.php')</code> : Name of file which records login attempts and IP bans.<br /></li>
|
||||
<li><code>BAN_AFTER (4)</code> : An IP address will be banned after this many failed login attempts.<br /></li>
|
||||
<li><code>BAN_DURATION (1800)</code> : Duration of ban (in seconds). (1800 seconds = 30 minutes)<br /></li>
|
||||
<li><code>OPEN_SHAARLI (false)</code> : If you set this option to true, anyone will be able to add/modify/delete/import/exports links without having to login.<br /></li>
|
||||
<li><code>HIDE_TIMESTAMPS (false)</code> : If you set this option to true, the date/time of each link will not be displayed (including in RSS Feed).#related-software<br /></li>
|
||||
<li><code>ENABLE_THUMBNAILS (true)</code> : Enable/disable thumbnails.<br /></li>
|
||||
<li><code>RAINTPL_TMP (tmp/)</code> : Raintpl cache directory (keep the trailing slash!)<br /></li>
|
||||
<li><code>RAINTPL_TPL (tpl/)</code> : Raintpl template directory (keep the trailing slash!). Edit this option if you want to change the rendering template (page structure) used by Shaarli. See <a href="#changing-template">Changing template</a><br /></li>
|
||||
<li><code>CACHEDIR ('cache')</code> : Directory where the thumbnails are stored.<br /></li>
|
||||
<li><code>ENABLE_LOCALCACHE (true)</code> : If you have a limited quota on your webspace, you can set this option to false: Shaarli will not generate thumbnails which need to be cached locally (vimeo, flickr, etc.). Thumbnails will still be visible for the services which do not use the local cache (youtube.com, imgur.com, dailymotion.com, imageshack.us)<br /></li>
|
||||
<li><code>UPDATECHECK_FILENAME ($GLOBALS['config']['DATADIR'].'/lastupdatecheck.txt')</code> : name of the file used to store available shaarli version.<br /></li>
|
||||
<li><code>UPDATECHECK_INTERVAL (86400)</code> : Delay between new Shaarli version check. 86400 seconds = 24 hours. Note that if you do not login for a week, Shaarli will not check for new version for a week.<br /></li>
|
||||
<li><code>ENABLE_UPDATECHECK</code>: Determines whether Shaarli check for new releases at <a href="https://github.com/shaarli/Shaarli">https://github.com/shaarli/Shaarli</a><br /></li>
|
||||
<li><code>SHOW_ATOM (false)</code> : Show an <code>ATOM Feed</code> button next to the <code>Subscribe</code> (RSS) button. ATOM feeds are available at the address <code>?do=atom</code> regardless of this option.<br /></li>
|
||||
<li><code>ARCHIVE_ORG (false)</code> : For each link, display a link to an archived version on archive.org<br /></li>
|
||||
<li><code>ENABLE_RSS_PERMALINKS (true)</code>: choose whether the RSS item title link points directly to the link, or to the entry on Shaarli (permalink). <code>true</code> is the original Shaarli bahevior (point directly to the link)<br /></li>
|
||||
<li><code>HIDE_PUBLIC_LINKS (false)</code>: setting this to true hides all links, even public ones, for non-logged in users.</li>
|
||||
</ul>
|
||||
<h3 id="changing-theme">Changing theme</h3>
|
||||
<ul>
|
||||
<li>Shaarli's apparence can be modified by editing CSS rules in <code>inc/user.css</code>. This file allows to override rules defined in the main <code>inc/shaarli.css</code> (only add changed rules), or define a whole new theme.<br /></li>
|
||||
<li>Do not edit <code>inc/shaarli.css</code>! Your changes would be overriden when updating Shaarli.<br /></li>
|
||||
<li>Some themes are available at <a href="https://github.com/shaarli/shaarli-themes">https://github.com/shaarli/shaarli-themes</a>.</li>
|
||||
</ul>
|
||||
<p>See also:</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/shaarli/Shaarli/wiki/Download-CSS-styles-for-shaarlis-listed-in-an-opml-file">Download CSS styles for shaarlis listed in an opml file</a></li>
|
||||
</ul>
|
||||
<h3 id="changing-template">Changing template</h3>
|
||||
<p>| WARNING | This feature is currently being worked on and will be improved in the next releases. Experimental. |<br />|---------|---------|</p>
|
||||
<ul>
|
||||
<li>Find the template you'd like to install. See the list of available templates (TODO). Find it's git clone URL or download the zip archive for the template.<br /></li>
|
||||
<li>In your Shaarli <code>tpl/</code> directory, run <code>git clone https://url/of/my-template/</code> or unpack the zip archive. There should now be a <code>my-template/</code> directory under the <code>tpl/</code> dir, containing directly all the template files.<br /></li>
|
||||
<li>Edit <code>data/options.php</code> to have Shaarli use this template. Eg.</li>
|
||||
</ul>
|
||||
<p><code>$GLOBALS['config']['RAINTPL_TPL'] = 'tpl/my-template/' ;</code></p>
|
||||
<p>You can find a list of compatible templates in <a href="#related-software">Related Software</a></p>
|
||||
<h1 id="backup">Backup</h1>
|
||||
<p>You have two ways of backing up your database:</p>
|
||||
<ul>
|
||||
<li><strong>Backup the file <code>data/datastore.php</code></strong> (by FTP or SSH). Restore by putting the file back in place.<br /></li>
|
||||
<li>Example command: <code>rsync -avzP my.server.com:/var/www/shaarli/data/datastore.php datastore-$(date +%Y-%m-%d_%H%M).php</code><br /></li>
|
||||
<li><strong>Export your links as HTML</strong> (Menu <code>Tools</code> > <code>Export</code>). Restore by using the <code>Import</code> feature.<br /></li>
|
||||
<li>This can be done using the <a href="https://github.com/nodiscc/shaarchiver">shaarchiver</a> tool. Example command: <code>./export-bookmarks.py --url=https://my.server.com/shaarli --username=myusername --password=mysupersecretpassword --download-dir=./ --type=all</code></li>
|
||||
</ul>
|
||||
<h1 id="troubleshooting">Troubleshooting</h1>
|
||||
<h3 id="i-forgot-my-password">I forgot my password !</h3>
|
||||
<p>Delete the file data/config.php and display the page again. You will be asked for a new login/password.</p>
|
||||
<h3 id="im-locked-out---login-bruteforce-protection">I'm locked out - Login bruteforce protection</h3>
|
||||
<p>Login form is protected against brute force attacks: 4 failed logins will ban the IP address from login for 30 minutes. Banned IPs can still browse links.</p>
|
||||
<p>To remove the current IP bans, delete the file <code>data/ipbans.php</code></p>
|
||||
<h3 id="list-of-all-login-attempts">List of all login attempts</h3>
|
||||
<p>The file <code>data/log.txt</code> shows all logins (successful or failed) and bans/lifted bans.<br />Search for <code>failed</code> in this file to look for unauthorized login attempts.</p>
|
||||
<h3 id="exporting-from-diigo">Exporting from Diigo</h3>
|
||||
<p>If you export your bookmark from Diigo, make sure you use the Delicious export, not the Netscape export. (Their Netscape export is broken, and they don't seem to be interested in fixing it.)</p>
|
||||
<h3 id="importing-from-semanticscuttle">Importing from SemanticScuttle</h3>
|
||||
<p>To correctly import the tags from a <a href="http://semanticscuttle.sourceforge.net/">SemanticScuttle</a> HTML export, edit the HTML file before importing and replace all occurences of <code>tags=</code> (lowercase) to <code>TAGS=</code> (uppercase).</p>
|
||||
<h3 id="importing-from-mister-wong">Importing from Mister Wong</h3>
|
||||
<p>See <a href="https://github.com/sebsauvage/Shaarli/issues/146">this issue</a> for import tweaks.</p>
|
||||
<h3 id="hosting-problems">Hosting problems</h3>
|
||||
<ul>
|
||||
<li>On <strong>free.fr</strong> : Please note that free uses php 5.1 and thus you will not have autocomplete in tag editing. Don't forget to create a <code>sessions</code> directory at the root of your webspace. Change the file extension to <code>.php5</code> or create a <code>.htaccess</code> file in the directory where Shaarli is located containing:</li>
|
||||
</ul>
|
||||
<pre><code>php 1
|
||||
SetEnv PHP_VER 5</code></pre>
|
||||
<ul>
|
||||
<li>If you have an error such as: <code>Parse error: syntax error, unexpected '=', expecting '(' in /links/index.php on line xxx</code>, it means that your host is using php4, not php5. Shaarli requires php 5.1. Try changing the file extension to <code>.php5</code><br /></li>
|
||||
<li>On <strong>1and1</strong> : If you add the link from the page (and not from the bookmarklet), Shaarli will no be able to get the title of the page. You will have to enter it manually. (Because they have disabled the ability to download a file through HTTP).<br /></li>
|
||||
<li>If you have the error <code>Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /…/index.php on line xxx</code>, it means that your host has disabled the ability to fetch a file by HTTP in the php config (Typically in 1and1 hosting). Bad host. Change host. Or comment the following lines:</li>
|
||||
</ul>
|
||||
<pre><code>//list($status,$headers,$data) = getHTTP($url,4); // Short timeout to keep the application responsive.
|
||||
// FIXME: Decode charset according to charset specified in either 1) HTTP response headers or 2) <head> in html
|
||||
//if (strpos($status,'200 OK')) $title=html_extract_title($data);</code></pre>
|
||||
<ul>
|
||||
<li>On hosts which forbid outgoing HTTP requests (such as free.fr), some thumbnails will not work.<br /></li>
|
||||
<li>On <strong>lost-oasis</strong>, RSS doesn't work correctly, because of this message at the begining of the RSS/ATOM feed : <code><? // tout ce qui est charge ici (generalement des includes et require) est charge en permanence. ?></code>. To fix this, remove this message from <code>php-include/prepend.php</code></li>
|
||||
</ul>
|
||||
<h3 id="dates-are-not-properly-formatted">Dates are not properly formatted</h3>
|
||||
<p>Shaarli tries to sniff the language of the browser (using HTTP_ACCEPT_LANGUAGE headers) and choose a date format accordingly. But Shaarli can only use the date formats (and more generaly speaking, the locales) provided by the webserver. So even if you have a browser in French, you may end up with dates in US format (it's the case on sebsauvage.net :-( )</p>
|
||||
<h3 id="problems-on-centos-servers">Problems on CentOS servers</h3>
|
||||
<p>On <strong>CentOS</strong>/RedHat derivatives, you may need to install the <code>php-mbstring</code> package.</p>
|
||||
<h3 id="my-session-expires-i-cant-stay-logged-in">My session expires ! I can't stay logged in</h3>
|
||||
<p>This can be caused by several things:</p>
|
||||
<ul>
|
||||
<li>Your php installation may not have a proper directory setup for session files. (eg. on Free.fr you need to create a <code>session</code> directory on the root of your website.) You may need to create the session directory of set it up.<br /></li>
|
||||
<li>Most hosts regularly clean the temporary and session directories. Your host may be cleaning those directories too aggressively (eg.OVH hosts), forcing an expire of the session. You may want to set the session directory in your web root. (eg. Create the <code>sessions</code> subdirectory and add <code>ini_set('session.save_path', $_SERVER['DOCUMENT_ROOT'].'/../sessions');</code>. Make sure this directory is not browsable !)<br /></li>
|
||||
<li>If your IP address changes during surfing, Shaarli will force expire your session for security reasons (to prevent session cookie hijacking). This can happen when surfing from WiFi or 3G (you may have switched WiFi/3G access point), or in some corporate/university proxies which use load balancing (and may have proxies with several external IP addresses).<br /></li>
|
||||
<li>Some browser addons may interfer with HTTP headers (ipfuck/ipflood/GreaseMonkey…). Try disabling those.<br /></li>
|
||||
<li>You may be using OperaTurbo or OperaMini, which use their own proxies which may change from time to time.<br /></li>
|
||||
<li>If you have another application on the same webserver where Shaarli is installed, these application may forcefully expire php sessions.</li>
|
||||
</ul>
|
||||
<h3 id="sessions-do-not-seem-to-work-correctly-on-your-server"><code>Sessions do not seem to work correctly on your server</code></h3>
|
||||
<p>Follow the instructions in the error message. Make sure you are accessing shaarli via a direct IP address or a proper hostname. If you have <strong>no dots</strong> in the hostname (e.g. <code>localhost</code> or <code>http://my-webserver/shaarli/</code>), some browsers will not store cookies at all (this respects the <a href="http://curl.haxx.se/rfc/cookie_spec.html">HTTP cookie specification</a>).</p>
|
||||
<h3 id="pubsubhubbub-support">pubsubhubbub support</h3>
|
||||
<p>Download <a href="https://pubsubhubbub.googlecode.com/git/publisher_clients/php/library/publisher.php">publisher.php</a> at the root of your Shaarli installation and set <code>$GLOBALS['config']['PUBSUBHUB_URL']</code> in your <code>config.php</code></p>
|
||||
<h1 id="notes">Notes</h1>
|
||||
<h3 id="various-hacks">Various hacks</h3>
|
||||
<ul>
|
||||
<li><a href="Example-patch---add-new-via-field-for-links">Example patch: add a new "via" field for links</a><br /></li>
|
||||
<li><a href="Copy-a-Shaarli-installation-over-SSH-SCP,-serve-it-locally-with-php-cli">Copy a Shaarli installation over SSH SCP, serve it locally with php cli</a><br /></li>
|
||||
<li><p>To display the array representing the data saved in datastore.php, use the following snippet</p>
|
||||
<pre><code>$data = "tZNdb9MwFIb... <Commented content inside datastore.php>";
|
||||
$out = unserialize(gzinflate(base64_decode($data)));
|
||||
echo "<pre>"; // Pretty printing is love, pretty printing is life
|
||||
print_r($out);
|
||||
echo "</pre>";
|
||||
exit;</code></pre>
|
||||
<p>This will output the internal representation of the datastore, "unobfuscated" (if this can really be considered obfuscation)</p></li>
|
||||
</ul>
|
||||
<h3 id="changing-timestamp-for-a-link">Changing timestamp for a link</h3>
|
||||
<ul>
|
||||
<li>Look for <code><input type="hidden" name="lf_linkdate" value="{$link.linkdate}"></code> in <code>tpl/editlink.tpl</code> (line 14)<br /></li>
|
||||
<li>Remove <code>type="hidden"</code> from this line<br /></li>
|
||||
<li>A new date/time field becomes available in the edit/new link dialog. You can set the timestamp manually by entering it in the format <code>YYYMMDD_HHMMS</code>.</li>
|
||||
</ul>
|
||||
<h1 id="related-software">Related software</h1>
|
||||
<p>Unofficial but relatedd work on Shaarli. If you maintain one of these, please get in touch with us to help us find a way to adapt your work to our fork. <strong>TODO</strong> contact repos owners to see if they'd like to standardize their work for the community fork.</p>
|
||||
<h3 id="server-apps">Server apps</h3>
|
||||
<ul>
|
||||
<li><a href="https://github.com/nodiscc/shaarchiver">shaarchiver</a> - Archive your Shaarli bookmarks and their content<br /></li>
|
||||
<li><a href="https://github.com/mknexen/shaarli-river">shaarli-river</a> - An aggregator for shaarlis with many features<br /></li>
|
||||
<li><a href="https://github.com/DMeloni/shaarlo">Shaarlo</a> - An aggregator for shaarlis with many features (a very popular running instance among french shaarliers: <a href="http://shaarli.fr/">shaarli.fr</a>)<br /></li>
|
||||
<li><a href="https://github.com/BoboTiG/shaarlimages">Shaarlimages</a> - An image-oriented aggregator for Shaarlis<br /></li>
|
||||
<li><a href="https://github.com/mknexen/shaarli-api">mknexen/shaarli-api</a> - A REST API for Shaarli</li>
|
||||
</ul>
|
||||
<h3 id="android-apps">Android apps</h3>
|
||||
<ul>
|
||||
<li><a href="http://sebsauvage.net/links/?ZAyDzg">Shaarli for Android</a> - Android application that adds Shaarli as a sharing provider<br /></li>
|
||||
<li><a href="https://github.com/dimtion/Shaarlier">Shaarlier for Android</a> - Android application to simply add links directly into your Shaarli</li>
|
||||
</ul>
|
||||
<h3 id="themes-templates">Themes & templates</h3>
|
||||
<ul>
|
||||
<li><a href="https://github.com/AkibaTech/Shaarli---SuperHero-Theme">AkibaTech/Shaarli Superhero Theme</a> - A template/theme for Shaarli<br /></li>
|
||||
<li><a href="https://github.com/alexisju/albinomouse-template">alexisju/albinomouse-template</a> - A full template for Shaarli<br /></li>
|
||||
<li><a href="https://github.com/dhoko/ShaarliTemplate">dhoko/ShaarliTemplate</a> - A template/theme for Shaarli<br /></li>
|
||||
<li><a href="https://github.com/kalvn/shaarli-blocks">kalvn/shaarli-blocks</a> - A template/theme for Shaarli<br /></li>
|
||||
<li><a href="https://github.com/kalvn/Shaarli-Material">kalvn/Shaarli-Material</a> - A theme (template) based on Google's Material Design for Shaarli, the superfast delicious clone.<br /></li>
|
||||
<li><a href="https://github.com/misterair/limonade">misterair/Limonade</a> - A fork of (legacy) Shaarli with a new template<br /></li>
|
||||
<li><a href="https://github.com/Vinm/Blue-theme-for-Shaarli">Vinm/Blue-theme-for Shaarli</a> - A template/theme for Shaarli (<a href="https://github.com/Vinm/Blue-theme-for-Shaarli/issues/2">unmaintained</a>, compatibility unknown)<br /></li>
|
||||
<li><a href="https://github.com/vivienhaese/shaarlitheme">vivienhaese/shaarlitheme</a> - A Shaarli fork meant to be run in an openshift instance</li>
|
||||
</ul>
|
||||
<h3 id="integrate-shaarli-with-other-platforms">Integrate Shaarli with other platforms</h3>
|
||||
<ul>
|
||||
<li><a href="https://github.com/jcsaaddupuy/tt-rss-shaarli">tt-rss-shaarli</a> - <a href="http://tt-rss.org/">TinyTiny RSS</a> plugin that adds support for sharing articles with Shaarli<br /></li>
|
||||
<li><a href="https://github.com/ahmet2mir/octopress-shaarli">octopress-shaarli</a> - octoprress plugin to retrieve SHaarli links on the sidebara</li>
|
||||
</ul>
|
||||
<h3 id="alternative-to-shaarli">Alternative to Shaarli</h3>
|
||||
<ul>
|
||||
<li><a href="https://github.com/bookieio/bookie">Bookie</a> - Another self-hostable, Free bookmark sharing software, written in Python<br /></li>
|
||||
<li><a href="https://github.com/plainmade/unmark">Unmark</a> - An open source to do app for bookmarks (<a href="https://unmark.it/">Homepage</a>)</li>
|
||||
</ul>
|
||||
<h1 id="other-links">Other links</h1>
|
||||
<ul>
|
||||
<li><a href="http://sebsauvage.net/links/">Liens en vrac de sebsauvage</a> - the original Shaarli<br /></li>
|
||||
<li><a href="http://porneia.free.fr/pub/links/ou-est-shaarli.html">A large list of Shaarlis</a><br /></li>
|
||||
<li><a href="https://raw.githubusercontent.com/Oros42/find_shaarlis/master/annuaires.json">A list of working Shaarli aggregators</a><br /></li>
|
||||
<li><a href="https://github.com/Oros42/shaarlis_list">A list of some known Shaarlis</a><br /></li>
|
||||
<li><a href="http://sebsauvage.net/rhaa/index.php?2011/09/16/09/29/58-adieu-delicious-diigo-et-stumbleupon-salut-shaarli-">Adieu Delicious, Diigo et StumbleUpon. Salut Shaarli ! - sebsauvage.net</a> (fr) <em>16/09/2011 - the original post about Shaarli</em><br /></li>
|
||||
<li><a href="http://sebsauvage.net/wiki/doku.php?id=php:shaarli:ideas">Original ideas/fixme/TODO page</a><br /></li>
|
||||
<li><a href="http://sebsauvage.net/wiki/doku.php?id=php:shaarli:discussion">Original discussion page</a> (fr)<br /></li>
|
||||
<li><a href="http://sebsauvage.net/wiki/doku.php?id=php:shaarli:history">Original revisions history</a><br /></li>
|
||||
<li><a href="https://www.shaarli.fr/my.php">Shaarli.fr/my</a> - Unofficial, unsupported (old fork) hosted Shaarlis provider, courtesy of <a href="https://github.com/DMeloni">DMeloni</a><br /></li>
|
||||
<li><a href="http://shaarferme.etudiant-libre.fr.nf/index.php">Shaarli Communauty</a> - Another unofficial Shaarli hoster (unsupported, old fork), hoster unknown</li>
|
||||
</ul>
|
||||
<h1 id="faq">FAQ</h1>
|
||||
<h3 id="why-did-you-create-shaarli">Why did you create Shaarli ?</h3>
|
||||
<p>I was a StumbleUpon user. Then I got fed up with they big toolbar. I switched to delicious, which was lighter, faster and more beautiful. Until Yahoo bought it. Then the export API broke all the time, delicious became slow and was ditched by Yahoo. I switched to Diigo, which is not bad, but does too much. And Diigo is sslllooooowww and their Firefox extension a bit buggy. And… oh… <strong>their Firefox addon sends to Diigo every single URL you visit</strong> (Don't believe me ? Use <a href="https://addons.mozilla.org/en-US/firefox/addon/tamper-data/">Tamper Data</a> and open any page).</p>
|
||||
<p>Enough is enough. Saving simple links should not be a complicated heavy thing. I ditched them all and wrote my own: Shaarli. It's simple, but it does the job and does it well. And my data is not hosted on a foreign server, but on my server.</p>
|
||||
<h3 id="why-use-shaarli-and-not-deliciousdiigo">Why use Shaarli and not Delicious/Diigo ?</h3>
|
||||
<p>With Shaarli:</p>
|
||||
<ul>
|
||||
<li>The data is yours: It's hosted on your server.<br /></li>
|
||||
<li>Never fear of having your data locked-in.<br /></li>
|
||||
<li>Never fear to have your data sold to third party.<br /></li>
|
||||
<li>Your private links are not hosted on a third party server.<br /></li>
|
||||
<li>You are not tracked by browser addons (like Diigo does)<br /></li>
|
||||
<li>You can change the look and feel of the pages if you want.<br /></li>
|
||||
<li>You can change the behaviour of the program.<br /></li>
|
||||
<li>It's magnitude faster than most bookmarking services.</li>
|
||||
</ul>
|
||||
<h3 id="what-does-shaarli-mean">What does Shaarli mean ?</h3>
|
||||
<p>Shaarli is for shaaring your links.</p>
|
||||
<h1 id="technical-details">Technical details</h1>
|
||||
<ul>
|
||||
<li>Application is protected against XSRF (Cross-site requests forgery): Forms which act on data (save,delete…) contain a token generated by the server. Any posted form which does not contain a valid token is rejected. Any token can only be used once. Token are attached to the session and cannot be reused in another session.<br /></li>
|
||||
<li>Sessions automatically expires after 60 minutes. Sessions are protected against highjacking: The sessionID cannot be used from a different IP address.<br /></li>
|
||||
<li>An .htaccess file protects the data file.<br /></li>
|
||||
<li><p>Link database is an associative array which is serialized, compressed (with deflate), base64-encoded and saved as a comment in a .php file. Thus even if the server does not support htaccess files, the data file will still not be readable by URL. The database looks like this:</p>
|
||||
<pre><code><?php /* zP1ZjxxJtiYIvvevEPJ2lDOaLrZv7o...
|
||||
...ka7gaco/Z+TFXM2i7BlfMf8qxpaSSYfKlvqv/x8= */ ?></code></pre></li>
|
||||
<li>The password is salted, hashed and stored in the data subdirectory, in a php file, and protected by htaccess. Even if the webserver does not support htaccess, the hash is not readable by URL. Even if the .php file is stolen, the password cannot deduced from the hash. The salt prevents rainbow-tables attacks.<br /></li>
|
||||
<li>Shaarli relies on <code>HTTP_REFERER</code> for some functions (like redirects and clicking on tags). If you have disabled or masqueraded <code>HTTP_REFERER</code> in your browser, some features of Shaarli may not work<br /></li>
|
||||
<li><code>magic_quotes</code> is a horrible option of php which is often activated on servers. No serious developer should rely on this horror to secure their code against SQL injections. You should disable it (and Shaarli expects this option to be disabled). Nevertheless, I have added code to cope with magic_quotes on, so you should not be bothered even on crappy hosts.<br /></li>
|
||||
<li><p>Small hashes are used to make a link to an entry in Shaarli. They are unique. In fact, the date of the items (eg.20110923_150523) is hashed with CRC32, then converted to base64 and some characters are replaced. They are always 6 characters longs and use only A-Z a-z 0-9 - _ and @.</p></li>
|
||||
</ul>
|
||||
<h3 id="directory-structure">Directory structure</h3>
|
||||
<p>Here is the directory structure of Shaarli and the purpose of the different files:</p>
|
||||
<pre><code> index.php : Main program.
|
||||
application/ : Shaarli classes
|
||||
├── LinkDB.php
|
||||
└── Utils.php
|
||||
tests/ : Shaarli unitary & functional tests
|
||||
├── LinkDBTest.php
|
||||
├── utils # utilities to ease testing
|
||||
│ └── ReferenceLinkDB.php
|
||||
└── UtilsTest.php
|
||||
COPYING : Shaarli license.
|
||||
inc/ : Includes (libraries, CSS…)
|
||||
├── awesomplete.*: tags autocompletion library
|
||||
├── blazy.*: picture wall lazy image loading library
|
||||
├── shaarli.css, reset.css : Shaarli stylesheet.
|
||||
├── qr.* : qr code generation library
|
||||
└──rain.tpl.class.php : RainTPL templating library.
|
||||
tpl/ : RainTPL templates for Shaarli. They are used to build the pages.
|
||||
images/ : Images and icons used in Shaarli.
|
||||
data/ : Directory where data is stored (bookmark database, configuration, logs, banlist…)
|
||||
├── config.php : Shaarli configuration (login, password, timezone, title…)
|
||||
├── datastore.php : Your link database (compressed).
|
||||
├── ipban.php : IP address ban system data.
|
||||
├── lastupdatecheck.txt : Update check timestamp file (used to check every 24 hours if a new version of Shaarli is available).
|
||||
└──log.txt : login/IPban log.
|
||||
cache/ : Directory containing the thumbnails cache. This directory is automatically created. You can erase it anytime you want.
|
||||
tmp/ : Temporary directory for compiled RainTPL templates. This directory is automatically created. You can erase it anytime you want.</code></pre>
|
||||
<h3 id="development">Development</h3>
|
||||
<ul>
|
||||
<li><a href="https://github.com/shaarli/Shaarli/tree/master/CONTRIBUTING.md">Contributing to Shaarli</a><br /></li>
|
||||
<li><a href="Running-unit-tests">Running unit tests</a><br /></li>
|
||||
<li>Patches should try to stick to the <a href="http://www.php-fig.org/psr/">PHP Standard Recommendations</a> (PSR), especially:<br /></li>
|
||||
<li><a href="http://www.php-fig.org/psr/psr-1/">PSR-1</a> - Basic Coding Standard<br /></li>
|
||||
<li><a href="http://www.php-fig.org/psr/psr-2/">PSR-2</a> - Coding Style Guide</li>
|
||||
</ul>
|
||||
<h3 id="why-not-use-a-real-database-files-are-slow">Why not use a real database ? Files are slow !</h3>
|
||||
<p>Does browsing <a href="http://sebsauvage.net/links/">this page</a> feel slow ? Try browsing older pages, too.</p>
|
||||
<p>It's not slow at all, is it ? And don't forget the database contains more than 16000 links, and it's on a shared host, with 32000 visitors/day for my website alone. And it's still damn fast. Why ?</p>
|
||||
<p>The data file is only 3.7 Mb. It's read 99% of the time, and is probably already in the operation system disk cache. So generating a page involves no I/O at all most of the time.</p>
|
||||
<h1 id="wiki---todo">Wiki - TODO</h1>
|
||||
<ul>
|
||||
<li>translate (new page can be called Home.fr, Home.es ... and linked from Home)<br /></li>
|
||||
<li>add more screenshots<br /></li>
|
||||
<li>add developer documentation (storage architecture, classes and functions, security handling, ...)</li>
|
||||
</ul>
|
||||
<p>Welcome to the <a href="https://github.com/shaarli/Shaarli/">Shaarli</a> wiki<embed src=".html" /></p>
|
||||
<p>Here you can find some info on how to use, configure, tweak and solve problems with your Shaarli.</p>
|
||||
<p>For general info, read the <a href="https://github.com/shaarli/Shaarli/blob/master/README.md">README</a>.<a href=".html"></a></p>
|
||||
<p>If you have any questions or ideas, please join the <a href="https://gitter.im/shaarli/Shaarli">chat</a> (also reachable via <a href="https://irc.gitter.im/">IRC</a>), post them in our <a href="https://github.com/shaarli/Shaarli/issues/44">general discussion</a> or read the current <a href="https://github.com/shaarli/Shaarli/issues">issues</a>. If you've found a bug, please create a <a href="https://github.com/shaarli/Shaarli/issues/new">new issue</a>.<a href=".html"></a></p>
|
||||
<p>If you would like a feature added to Shaarli, check the issues labeled <a href="https://github.com/shaarli/Shaarli/labels/feature"><code>feature</code></a>, <a href="https://github.com/shaarli/Shaarli/labels/enhancement"><code>enhancement</code></a>, and <a href="https://github.com/shaarli/Shaarli/labels/plugin"><code>plugin</code></a>.<a href=".html"></a></p>
|
||||
<p><em>Note: This documentation is available online at <a href="https://github.com/shaarli/Shaarli/wiki" class="uri">https://github.com/shaarli/Shaarli/wiki</a>, and locally in the <code>doc/</code> directory of your Shaarli installation.</em></p>
|
||||
</body>
|
||||
</html>
|
||||
|
|
453
doc/Home.md
453
doc/Home.md
|
@ -1,449 +1,14 @@
|
|||
#Home
|
||||
# Shaarli wiki
|
||||
|
||||
Welcome to the [Shaarli](https://github.com/shaarli/Shaarli/) wiki! Here you can find some info on how to use, configure, tweak and solve problems with your Shaarli. For general info, read the [README](https://github.com/shaarli/Shaarli/blob/master/README.md).
|
||||
Welcome to the [Shaarli](https://github.com/shaarli/Shaarli/) wiki![](.html)
|
||||
|
||||
If you have any questions or ideas, please join the [chat](https://gitter.im/shaarli/Shaarli) (also reachable via [IRC](https://irc.gitter.im/)), post them in our [general discussion](https://github.com/shaarli/Shaarli/issues/44) or read the current [issues](https://github.com/shaarli/Shaarli/issues). If you've found a bug, please create a [new issue](https://github.com/shaarli/Shaarli/issues/new). If you would like a feature added to Shaarli, check the issues labeled [`feature`](https://github.com/shaarli/Shaarli/labels/feature), [`enhancement`](https://github.com/shaarli/Shaarli/labels/enhancement), and [`plugin`](https://github.com/shaarli/Shaarli/labels/plugin).
|
||||
Here you can find some info on how to use, configure, tweak and solve problems with your Shaarli.
|
||||
|
||||
For general info, read the [README](https://github.com/shaarli/Shaarli/blob/master/README.md).[](.html)
|
||||
|
||||
If you have any questions or ideas, please join the [chat](https://gitter.im/shaarli/Shaarli) (also reachable via [IRC](https://irc.gitter.im/)), post them in our [general discussion](https://github.com/shaarli/Shaarli/issues/44) or read the current [issues](https://github.com/shaarli/Shaarli/issues). If you've found a bug, please create a [new issue](https://github.com/shaarli/Shaarli/issues/new).[](.html)
|
||||
|
||||
If you would like a feature added to Shaarli, check the issues labeled [`feature`](https://github.com/shaarli/Shaarli/labels/feature), [`enhancement`](https://github.com/shaarli/Shaarli/labels/enhancement), and [`plugin`](https://github.com/shaarli/Shaarli/labels/plugin).[](.html)
|
||||
|
||||
_Note: This documentation is available online at https://github.com/shaarli/Shaarli/wiki, and locally in the `doc/` directory of your Shaarli installation._
|
||||
|
||||
----------------------------------------------------------------------------------
|
||||
|
||||
<!-- MarkdownTOC depth=3 -->
|
||||
|
||||
- [Basic Usage](#basic-usage)
|
||||
- [Add the sharing button (_bookmarklet_) to your browser](#add-the-sharing-button-_bookmarklet_-to-your-browser)
|
||||
- [Add Shaarli as a sharing service to Firefox](#add-shaarli-as-a-sharing-service-to-firefox)
|
||||
- [Share links using the _bookmarklet_](#share-links-using-the-_bookmarklet_)
|
||||
- [Sharing links using Firefox share](#sharing-links-using-firefox-share)
|
||||
- [Other usage examples](#other-usage-examples)
|
||||
- [Using Shaarli as a blog, notepad, pastebin...](#using-shaarli-as-a-blog-notepad-pastebin)
|
||||
- [RSS Feeds or Picture Wall for a specific search/tag](#rss-feeds-or-picture-wall-for-a-specific-searchtag)
|
||||
- [Configuration](#configuration)
|
||||
- [Main data/options.php file](#main-dataoptionsphp-file)
|
||||
- [Changing theme](#changing-theme)
|
||||
- [Changing template](#changing-template)
|
||||
- [Backup](#backup)
|
||||
- [Troubleshooting](#troubleshooting)
|
||||
- [I forgot my password !](#i-forgot-my-password-)
|
||||
- [I'm locked out - Login bruteforce protection](#im-locked-out---login-bruteforce-protection)
|
||||
- [List of all login attempts](#list-of-all-login-attempts)
|
||||
- [Exporting from Diigo](#exporting-from-diigo)
|
||||
- [Importing from SemanticScuttle](#importing-from-semanticscuttle)
|
||||
- [Importing from Mister Wong](#importing-from-mister-wong)
|
||||
- [Hosting problems](#hosting-problems)
|
||||
- [Dates are not properly formatted](#dates-are-not-properly-formatted)
|
||||
- [Problems on CentOS servers](#problems-on-centos-servers)
|
||||
- [My session expires ! I can't stay logged in](#my-session-expires--i-cant-stay-logged-in)
|
||||
- [`Sessions do not seem to work correctly on your server`](#sessions-do-not-seem-to-work-correctly-on-your-server)
|
||||
- [pubsubhubbub support](#pubsubhubbub-support)
|
||||
- [Notes](#notes)
|
||||
- [Various hacks](#various-hacks)
|
||||
- [Changing timestamp for a link](#changing-timestamp-for-a-link)
|
||||
- [Related software](#related-software)
|
||||
- [Server apps](#server-apps)
|
||||
- [Android apps](#android-apps)
|
||||
- [Themes & templates](#themes--templates)
|
||||
- [Integrate Shaarli with other platforms](#integrate-shaarli-with-other-platforms)
|
||||
- [Alternative to Shaarli](#alternative-to-shaarli)
|
||||
- [Other links](#other-links)
|
||||
- [FAQ](#faq)
|
||||
- [Why did you create Shaarli ?](#why-did-you-create-shaarli-)
|
||||
- [Why use Shaarli and not Delicious/Diigo ?](#why-use-shaarli-and-not-deliciousdiigo-)
|
||||
- [What does Shaarli mean ?](#what-does-shaarli-mean-)
|
||||
- [Technical details](#technical-details)
|
||||
- [Directory structure](#directory-structure)
|
||||
- [Development](#development)
|
||||
- [Why not use a real database ? Files are slow !](#why-not-use-a-real-database--files-are-slow-)
|
||||
- [Wiki - TODO](#wiki---todo)
|
||||
|
||||
<!-- /MarkdownTOC -->
|
||||
|
||||
|
||||
|
||||
------------------------------------------------------------------
|
||||
|
||||
# Basic Usage
|
||||
|
||||
### Add the sharing button (_bookmarklet_) to your browser
|
||||
|
||||
* Open your Shaarli and `Login`
|
||||
* Click the `Tools` button in the top bar
|
||||
* Drag the **`✚Shaare link` button**, and drop it to your browser's bookmarks bar.
|
||||
|
||||
_This bookmarklet button in compatible with Firefox, Opera, Chrome and Safari. Under Opera, you can't drag'n drop the button: You have to right-click on it and add a bookmark to your personal toolbar._
|
||||
|
||||
![](images/bookmarklet.png)
|
||||
|
||||
|
||||
### Add Shaarli as a sharing service to Firefox
|
||||
|
||||
* Open your Shaarli and `Login`
|
||||
* Click the `Tools` button in the top bar
|
||||
* Click the `✚Add to Firefox social` button and accept the activation.
|
||||
|
||||
|
||||
### Share links using the _bookmarklet_
|
||||
|
||||
* When you are visiting a webpage you would like to share with Shaarli, click the _bookmarklet_ you just added.
|
||||
* A window opens.
|
||||
* You can freely edit title, description, tags... to find it later using the text search or tag filtering.
|
||||
* You will be able to edit this link later using the ![](https://raw.githubusercontent.com/shaarli/Shaarli/master/images/edit_icon.png) edit button.
|
||||
* You can also check the “Private” box so that the link is saved but only visible to you.
|
||||
* Click `Save`.**Voila! Your link is now shared.**
|
||||
|
||||
|
||||
### Sharing links using Firefox share
|
||||
|
||||
* Add the sharing service as described above
|
||||
* When you are visiting a webpage you would like to share with Shaarli, click the Firefox _Share_ button [[images/firefoxshare.png]]
|
||||
* You can edit your link before and after saving, just like the bookmarklet above.
|
||||
|
||||
|
||||
# Other usage examples
|
||||
Shaarli can be used:
|
||||
|
||||
* to share, comment and save interesting links and news
|
||||
* to bookmark useful/frequent personal links (as private links) and share them between computers
|
||||
* as a minimal blog/microblog/writing platform (no character limit)
|
||||
* as a read-it-later list (for example items tagged `readlater`)
|
||||
* to draft and save articles/ideas
|
||||
* to keep code snippets
|
||||
* to keep notes and documentation
|
||||
* as a shared clipboard between machines
|
||||
* as a todo list
|
||||
* to store playlists (e.g. with the `music` or `video` tags)
|
||||
* to keep extracts/comments from webpages that may disappear
|
||||
* to keep track of ongoing discussions (for example items tagged `discussion`)
|
||||
* [to feed RSS aggregators](http://shaarli.chassegnouf.net/?9Efeiw) (planets) with specific tags
|
||||
* to feed other social networks, blogs... using RSS feeds and external services (dlvr.it, ifttt.com ...)
|
||||
|
||||
### Using Shaarli as a blog, notepad, pastebin...
|
||||
|
||||
* Go to your Shaarli setup and log in
|
||||
* Click the `Add Link` button
|
||||
* To share text only, do not enter any URL in the corresponding input field and click `Add Link`
|
||||
* Pick a title and enter your article, or note, in the description field; add a few tags; optionally check `Private` then click `Save`
|
||||
* Voilà! Your article is now published (privately if you selected that option) and accessible using its permalink.
|
||||
|
||||
|
||||
### RSS Feeds or Picture Wall for a specific search/tag
|
||||
It is possible to filter RSS/ATOM feeds and Picture Wall on a Shaarli to **only display results of a specific search, or for a specific tag**. For example, if you want to subscribe only to links tagged `photography`:
|
||||
* Go to the desired Shaarli instance.
|
||||
* Search for the `photography` tag in the _Filter by tag_ box. Links tagged `photography` are displayed.
|
||||
* Click on the `RSS Feed` button.
|
||||
* You are presented with an RSS feed showing only these links. Subscribe to it to receive only updates with this tag.
|
||||
* The same method **also works for a full-text search** (_Search_ box) **and for the Picture Wall** (want to only see pictures about `nature`?)
|
||||
* You can also build the URL manually: `https://my.shaarli.domain/?do=rss&searchtags=nature`, `https://my.shaarli.domain/links/?do=picwall&searchterm=poney`
|
||||
|
||||
![](images/rss-filter-1.png) ![](images/rss-filter-2.png)
|
||||
|
||||
# Configuration
|
||||
|
||||
### Main data/options.php file
|
||||
|
||||
To change the configuration, create the file `data/options.php`, example:
|
||||
```
|
||||
<?php
|
||||
$GLOBALS['config']['LINKS_PER_PAGE'] = 30;
|
||||
$GLOBALS['config']['HIDE_TIMESTAMPS'] = true;
|
||||
$GLOBALS['config']['ENABLE_THUMBNAILS'] = false;
|
||||
?>
|
||||
```
|
||||
|
||||
**Do not edit config options in index.php! Your changes would be lost when you upgrade.** The following parameters are available (parameters (default value)):
|
||||
|
||||
* `DATADIR ('data')` : This is the name of the subdirectory where Shaarli stores is data file. You can change it for better security.
|
||||
* `CONFIG_FILE ($GLOBALS['config']['DATADIR'].'/config.php')` : Name of file which is used to store login/password.
|
||||
* `DATASTORE ($GLOBALS['config']['DATADIR'].'/datastore.php')` : Name of file which contains the link database.
|
||||
* `LINKS_PER_PAGE (20)` : Default number of links per page displayed.
|
||||
* `IPBANS_FILENAME ($GLOBALS['config']['DATADIR'].'/ipbans.php')` : Name of file which records login attempts and IP bans.
|
||||
* `BAN_AFTER (4)` : An IP address will be banned after this many failed login attempts.
|
||||
* `BAN_DURATION (1800)` : Duration of ban (in seconds). (1800 seconds = 30 minutes)
|
||||
* `OPEN_SHAARLI (false)` : If you set this option to true, anyone will be able to add/modify/delete/import/exports links without having to login.
|
||||
* `HIDE_TIMESTAMPS (false)` : If you set this option to true, the date/time of each link will not be displayed (including in RSS Feed).#related-software
|
||||
* `ENABLE_THUMBNAILS (true)` : Enable/disable thumbnails.
|
||||
* `RAINTPL_TMP (tmp/)` : Raintpl cache directory (keep the trailing slash!)
|
||||
* `RAINTPL_TPL (tpl/)` : Raintpl template directory (keep the trailing slash!). Edit this option if you want to change the rendering template (page structure) used by Shaarli. See [Changing template](#changing-template)
|
||||
* `CACHEDIR ('cache')` : Directory where the thumbnails are stored.
|
||||
* `ENABLE_LOCALCACHE (true)` : If you have a limited quota on your webspace, you can set this option to false: Shaarli will not generate thumbnails which need to be cached locally (vimeo, flickr, etc.). Thumbnails will still be visible for the services which do not use the local cache (youtube.com, imgur.com, dailymotion.com, imageshack.us)
|
||||
* `UPDATECHECK_FILENAME ($GLOBALS['config']['DATADIR'].'/lastupdatecheck.txt')` : name of the file used to store available shaarli version.
|
||||
* `UPDATECHECK_INTERVAL (86400)` : Delay between new Shaarli version check. 86400 seconds = 24 hours. Note that if you do not login for a week, Shaarli will not check for new version for a week.
|
||||
* `ENABLE_UPDATECHECK`: Determines whether Shaarli check for new releases at https://github.com/shaarli/Shaarli
|
||||
* `SHOW_ATOM (false)` : Show an `ATOM Feed` button next to the `Subscribe` (RSS) button. ATOM feeds are available at the address `?do=atom` regardless of this option.
|
||||
* `ARCHIVE_ORG (false)` : For each link, display a link to an archived version on archive.org
|
||||
* `ENABLE_RSS_PERMALINKS (true)`: choose whether the RSS item title link points directly to the link, or to the entry on Shaarli (permalink). `true` is the original Shaarli bahevior (point directly to the link)
|
||||
* `HIDE_PUBLIC_LINKS (false)`: setting this to true hides all links, even public ones, for non-logged in users.
|
||||
|
||||
|
||||
### Changing theme
|
||||
* Shaarli's apparence can be modified by editing CSS rules in `inc/user.css`. This file allows to override rules defined in the main `inc/shaarli.css` (only add changed rules), or define a whole new theme.
|
||||
* Do not edit `inc/shaarli.css`! Your changes would be overriden when updating Shaarli.
|
||||
* Some themes are available at https://github.com/shaarli/shaarli-themes.
|
||||
|
||||
See also:
|
||||
* [Download CSS styles for shaarlis listed in an opml file](https://github.com/shaarli/Shaarli/wiki/Download-CSS-styles-for-shaarlis-listed-in-an-opml-file)
|
||||
|
||||
### Changing template
|
||||
|
||||
| WARNING | This feature is currently being worked on and will be improved in the next releases. Experimental. |
|
||||
|---------|---------|
|
||||
|
||||
* Find the template you'd like to install. See the list of available templates (TODO). Find it's git clone URL or download the zip archive for the template.
|
||||
* In your Shaarli `tpl/` directory, run `git clone https://url/of/my-template/` or unpack the zip archive. There should now be a `my-template/` directory under the `tpl/` dir, containing directly all the template files.
|
||||
* Edit `data/options.php` to have Shaarli use this template. Eg.
|
||||
|
||||
`$GLOBALS['config']['RAINTPL_TPL'] = 'tpl/my-template/' ;`
|
||||
|
||||
You can find a list of compatible templates in [Related Software](#related-software)
|
||||
|
||||
# Backup
|
||||
|
||||
You have two ways of backing up your database:
|
||||
* **Backup the file `data/datastore.php`** (by FTP or SSH). Restore by putting the file back in place.
|
||||
* Example command: `rsync -avzP my.server.com:/var/www/shaarli/data/datastore.php datastore-$(date +%Y-%m-%d_%H%M).php`
|
||||
* **Export your links as HTML** (Menu `Tools` > `Export`). Restore by using the `Import` feature.
|
||||
* This can be done using the [shaarchiver](https://github.com/nodiscc/shaarchiver) tool. Example command: `./export-bookmarks.py --url=https://my.server.com/shaarli --username=myusername --password=mysupersecretpassword --download-dir=./ --type=all`
|
||||
|
||||
|
||||
# Troubleshooting
|
||||
|
||||
### I forgot my password !
|
||||
|
||||
Delete the file data/config.php and display the page again. You will be asked for a new login/password.
|
||||
|
||||
|
||||
|
||||
### I'm locked out - Login bruteforce protection
|
||||
Login form is protected against brute force attacks: 4 failed logins will ban the IP address from login for 30 minutes. Banned IPs can still browse links.
|
||||
|
||||
To remove the current IP bans, delete the file `data/ipbans.php`
|
||||
|
||||
### List of all login attempts
|
||||
|
||||
The file `data/log.txt` shows all logins (successful or failed) and bans/lifted bans.
|
||||
Search for `failed` in this file to look for unauthorized login attempts.
|
||||
|
||||
|
||||
### Exporting from Diigo
|
||||
|
||||
If you export your bookmark from Diigo, make sure you use the Delicious export, not the Netscape export. (Their Netscape export is broken, and they don't seem to be interested in fixing it.)
|
||||
|
||||
### Importing from SemanticScuttle
|
||||
|
||||
To correctly import the tags from a [SemanticScuttle](http://semanticscuttle.sourceforge.net/) HTML export, edit the HTML file before importing and replace all occurences of `tags=` (lowercase) to `TAGS=` (uppercase).
|
||||
|
||||
### Importing from Mister Wong
|
||||
See [this issue](https://github.com/sebsauvage/Shaarli/issues/146) for import tweaks.
|
||||
|
||||
|
||||
### Hosting problems
|
||||
* On **free.fr** : Please note that free uses php 5.1 and thus you will not have autocomplete in tag editing. Don't forget to create a `sessions` directory at the root of your webspace. Change the file extension to `.php5` or create a `.htaccess` file in the directory where Shaarli is located containing:
|
||||
|
||||
```
|
||||
php 1
|
||||
SetEnv PHP_VER 5
|
||||
```
|
||||
|
||||
* If you have an error such as: `Parse error: syntax error, unexpected '=', expecting '(' in /links/index.php on line xxx`, it means that your host is using php4, not php5. Shaarli requires php 5.1. Try changing the file extension to `.php5`
|
||||
* On **1and1** : If you add the link from the page (and not from the bookmarklet), Shaarli will no be able to get the title of the page. You will have to enter it manually. (Because they have disabled the ability to download a file through HTTP).
|
||||
* If you have the error `Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /…/index.php on line xxx`, it means that your host has disabled the ability to fetch a file by HTTP in the php config (Typically in 1and1 hosting). Bad host. Change host. Or comment the following lines:
|
||||
|
||||
```
|
||||
//list($status,$headers,$data) = getHTTP($url,4); // Short timeout to keep the application responsive.
|
||||
// FIXME: Decode charset according to charset specified in either 1) HTTP response headers or 2) <head> in html
|
||||
//if (strpos($status,'200 OK')) $title=html_extract_title($data);
|
||||
```
|
||||
|
||||
* On hosts which forbid outgoing HTTP requests (such as free.fr), some thumbnails will not work.
|
||||
* On **lost-oasis**, RSS doesn't work correctly, because of this message at the begining of the RSS/ATOM feed : `<? // tout ce qui est charge ici (generalement des includes et require) est charge en permanence. ?>`. To fix this, remove this message from `php-include/prepend.php`
|
||||
|
||||
### Dates are not properly formatted
|
||||
Shaarli tries to sniff the language of the browser (using HTTP_ACCEPT_LANGUAGE headers) and choose a date format accordingly. But Shaarli can only use the date formats (and more generaly speaking, the locales) provided by the webserver. So even if you have a browser in French, you may end up with dates in US format (it's the case on sebsauvage.net :-( )
|
||||
|
||||
### Problems on CentOS servers
|
||||
On **CentOS**/RedHat derivatives, you may need to install the `php-mbstring` package.
|
||||
|
||||
|
||||
### My session expires ! I can't stay logged in
|
||||
This can be caused by several things:
|
||||
|
||||
* Your php installation may not have a proper directory setup for session files. (eg. on Free.fr you need to create a `session` directory on the root of your website.) You may need to create the session directory of set it up.
|
||||
* Most hosts regularly clean the temporary and session directories. Your host may be cleaning those directories too aggressively (eg.OVH hosts), forcing an expire of the session. You may want to set the session directory in your web root. (eg. Create the `sessions` subdirectory and add `ini_set('session.save_path', $_SERVER['DOCUMENT_ROOT'].'/../sessions');`. Make sure this directory is not browsable !)
|
||||
* If your IP address changes during surfing, Shaarli will force expire your session for security reasons (to prevent session cookie hijacking). This can happen when surfing from WiFi or 3G (you may have switched WiFi/3G access point), or in some corporate/university proxies which use load balancing (and may have proxies with several external IP addresses).
|
||||
* Some browser addons may interfer with HTTP headers (ipfuck/ipflood/GreaseMonkey…). Try disabling those.
|
||||
* You may be using OperaTurbo or OperaMini, which use their own proxies which may change from time to time.
|
||||
* If you have another application on the same webserver where Shaarli is installed, these application may forcefully expire php sessions.
|
||||
|
||||
### `Sessions do not seem to work correctly on your server`
|
||||
Follow the instructions in the error message. Make sure you are accessing shaarli via a direct IP address or a proper hostname. If you have **no dots** in the hostname (e.g. `localhost` or `http://my-webserver/shaarli/`), some browsers will not store cookies at all (this respects the [HTTP cookie specification](http://curl.haxx.se/rfc/cookie_spec.html)).
|
||||
|
||||
|
||||
### pubsubhubbub support
|
||||
|
||||
Download [publisher.php](https://pubsubhubbub.googlecode.com/git/publisher_clients/php/library/publisher.php) at the root of your Shaarli installation and set `$GLOBALS['config']['PUBSUBHUB_URL']` in your `config.php`
|
||||
|
||||
# Notes
|
||||
### Various hacks
|
||||
|
||||
* [Example patch: add a new "via" field for links](Example-patch---add-new-via-field-for-links)
|
||||
* [Copy a Shaarli installation over SSH SCP, serve it locally with php cli](Copy-a-Shaarli-installation-over-SSH-SCP,-serve-it-locally-with-php-cli)
|
||||
* To display the array representing the data saved in datastore.php, use the following snippet
|
||||
```
|
||||
$data = "tZNdb9MwFIb... <Commented content inside datastore.php>";
|
||||
$out = unserialize(gzinflate(base64_decode($data)));
|
||||
echo "<pre>"; // Pretty printing is love, pretty printing is life
|
||||
print_r($out);
|
||||
echo "</pre>";
|
||||
exit;
|
||||
```
|
||||
This will output the internal representation of the datastore, "unobfuscated" (if this can really be considered obfuscation)
|
||||
|
||||
### Changing timestamp for a link
|
||||
* Look for `<input type="hidden" name="lf_linkdate" value="{$link.linkdate}">` in `tpl/editlink.tpl` (line 14)
|
||||
* Remove `type="hidden"` from this line
|
||||
* A new date/time field becomes available in the edit/new link dialog. You can set the timestamp manually by entering it in the format `YYYMMDD_HHMMS`.
|
||||
|
||||
|
||||
# Related software
|
||||
Unofficial but relatedd work on Shaarli. If you maintain one of these, please get in touch with us to help us find a way to adapt your work to our fork. **TODO** contact repos owners to see if they'd like to standardize their work for the community fork.
|
||||
### Server apps
|
||||
* [shaarchiver](https://github.com/nodiscc/shaarchiver) - Archive your Shaarli bookmarks and their content
|
||||
* [shaarli-river](https://github.com/mknexen/shaarli-river) - An aggregator for shaarlis with many features
|
||||
* [Shaarlo](https://github.com/DMeloni/shaarlo) - An aggregator for shaarlis with many features (a very popular running instance among french shaarliers: [shaarli.fr](http://shaarli.fr/))
|
||||
* [Shaarlimages](https://github.com/BoboTiG/shaarlimages) - An image-oriented aggregator for Shaarlis
|
||||
* [mknexen/shaarli-api](https://github.com/mknexen/shaarli-api) - A REST API for Shaarli
|
||||
|
||||
### Android apps
|
||||
* [Shaarli for Android](http://sebsauvage.net/links/?ZAyDzg) - Android application that adds Shaarli as a sharing provider
|
||||
* [Shaarlier for Android](https://github.com/dimtion/Shaarlier) - Android application to simply add links directly into your Shaarli
|
||||
|
||||
### Themes & templates
|
||||
* [AkibaTech/Shaarli Superhero Theme](https://github.com/AkibaTech/Shaarli---SuperHero-Theme) - A template/theme for Shaarli
|
||||
* [alexisju/albinomouse-template](https://github.com/alexisju/albinomouse-template) - A full template for Shaarli
|
||||
* [dhoko/ShaarliTemplate](https://github.com/dhoko/ShaarliTemplate) - A template/theme for Shaarli
|
||||
* [kalvn/shaarli-blocks](https://github.com/kalvn/shaarli-blocks) - A template/theme for Shaarli
|
||||
* [kalvn/Shaarli-Material](https://github.com/kalvn/Shaarli-Material) - A theme (template) based on Google's Material Design for Shaarli, the superfast delicious clone.
|
||||
* [misterair/Limonade](https://github.com/misterair/limonade) - A fork of (legacy) Shaarli with a new template
|
||||
* [Vinm/Blue-theme-for Shaarli](https://github.com/Vinm/Blue-theme-for-Shaarli) - A template/theme for Shaarli ([unmaintained](https://github.com/Vinm/Blue-theme-for-Shaarli/issues/2), compatibility unknown)
|
||||
* [vivienhaese/shaarlitheme](https://github.com/vivienhaese/shaarlitheme) - A Shaarli fork meant to be run in an openshift instance
|
||||
|
||||
### Integrate Shaarli with other platforms
|
||||
* [tt-rss-shaarli](https://github.com/jcsaaddupuy/tt-rss-shaarli) - [TinyTiny RSS](http://tt-rss.org/) plugin that adds support for sharing articles with Shaarli
|
||||
* [octopress-shaarli](https://github.com/ahmet2mir/octopress-shaarli) - octoprress plugin to retrieve SHaarli links on the sidebara
|
||||
|
||||
### Alternative to Shaarli
|
||||
* [Bookie](https://github.com/bookieio/bookie) - Another self-hostable, Free bookmark sharing software, written in Python
|
||||
* [Unmark](https://github.com/plainmade/unmark) - An open source to do app for bookmarks ([Homepage](https://unmark.it/))
|
||||
|
||||
|
||||
|
||||
# Other links
|
||||
* [Liens en vrac de sebsauvage](http://sebsauvage.net/links/) - the original Shaarli
|
||||
* [A large list of Shaarlis](http://porneia.free.fr/pub/links/ou-est-shaarli.html)
|
||||
* [A list of working Shaarli aggregators](https://raw.githubusercontent.com/Oros42/find_shaarlis/master/annuaires.json)
|
||||
* [A list of some known Shaarlis](https://github.com/Oros42/shaarlis_list)
|
||||
* [Adieu Delicious, Diigo et StumbleUpon. Salut Shaarli ! - sebsauvage.net](http://sebsauvage.net/rhaa/index.php?2011/09/16/09/29/58-adieu-delicious-diigo-et-stumbleupon-salut-shaarli-) (fr) _16/09/2011 - the original post about Shaarli_
|
||||
* [Original ideas/fixme/TODO page](http://sebsauvage.net/wiki/doku.php?id=php:shaarli:ideas)
|
||||
* [Original discussion page](http://sebsauvage.net/wiki/doku.php?id=php:shaarli:discussion) (fr)
|
||||
* [Original revisions history](http://sebsauvage.net/wiki/doku.php?id=php:shaarli:history)
|
||||
* [Shaarli.fr/my](https://www.shaarli.fr/my.php) - Unofficial, unsupported (old fork) hosted Shaarlis provider, courtesy of [DMeloni](https://github.com/DMeloni)
|
||||
* [Shaarli Communauty](http://shaarferme.etudiant-libre.fr.nf/index.php) - Another unofficial Shaarli hoster (unsupported, old fork), hoster unknown
|
||||
|
||||
|
||||
|
||||
|
||||
# FAQ
|
||||
|
||||
### Why did you create Shaarli ?
|
||||
|
||||
I was a StumbleUpon user. Then I got fed up with they big toolbar. I switched to delicious, which was lighter, faster and more beautiful. Until Yahoo bought it. Then the export API broke all the time, delicious became slow and was ditched by Yahoo. I switched to Diigo, which is not bad, but does too much. And Diigo is sslllooooowww and their Firefox extension a bit buggy. And… oh… **their Firefox addon sends to Diigo every single URL you visit** (Don't believe me ? Use [Tamper Data](https://addons.mozilla.org/en-US/firefox/addon/tamper-data/) and open any page).
|
||||
|
||||
Enough is enough. Saving simple links should not be a complicated heavy thing. I ditched them all and wrote my own: Shaarli. It's simple, but it does the job and does it well. And my data is not hosted on a foreign server, but on my server.
|
||||
|
||||
### Why use Shaarli and not Delicious/Diigo ?
|
||||
|
||||
With Shaarli:
|
||||
|
||||
* The data is yours: It's hosted on your server.
|
||||
* Never fear of having your data locked-in.
|
||||
* Never fear to have your data sold to third party.
|
||||
* Your private links are not hosted on a third party server.
|
||||
* You are not tracked by browser addons (like Diigo does)
|
||||
* You can change the look and feel of the pages if you want.
|
||||
* You can change the behaviour of the program.
|
||||
* It's magnitude faster than most bookmarking services.
|
||||
|
||||
### What does Shaarli mean ?
|
||||
|
||||
Shaarli is for shaaring your links.
|
||||
|
||||
|
||||
|
||||
# Technical details
|
||||
* Application is protected against XSRF (Cross-site requests forgery): Forms which act on data (save,delete…) contain a token generated by the server. Any posted form which does not contain a valid token is rejected. Any token can only be used once. Token are attached to the session and cannot be reused in another session.
|
||||
* Sessions automatically expires after 60 minutes. Sessions are protected against highjacking: The sessionID cannot be used from a different IP address.
|
||||
* An .htaccess file protects the data file.
|
||||
* Link database is an associative array which is serialized, compressed (with deflate), base64-encoded and saved as a comment in a .php file. Thus even if the server does not support htaccess files, the data file will still not be readable by URL. The database looks like this:
|
||||
```
|
||||
<?php /* zP1ZjxxJtiYIvvevEPJ2lDOaLrZv7o...
|
||||
...ka7gaco/Z+TFXM2i7BlfMf8qxpaSSYfKlvqv/x8= */ ?>
|
||||
```
|
||||
|
||||
* The password is salted, hashed and stored in the data subdirectory, in a php file, and protected by htaccess. Even if the webserver does not support htaccess, the hash is not readable by URL. Even if the .php file is stolen, the password cannot deduced from the hash. The salt prevents rainbow-tables attacks.
|
||||
* Shaarli relies on `HTTP_REFERER` for some functions (like redirects and clicking on tags). If you have disabled or masqueraded `HTTP_REFERER` in your browser, some features of Shaarli may not work
|
||||
* `magic_quotes` is a horrible option of php which is often activated on servers. No serious developer should rely on this horror to secure their code against SQL injections. You should disable it (and Shaarli expects this option to be disabled). Nevertheless, I have added code to cope with magic_quotes on, so you should not be bothered even on crappy hosts.
|
||||
* Small hashes are used to make a link to an entry in Shaarli. They are unique. In fact, the date of the items (eg.20110923_150523) is hashed with CRC32, then converted to base64 and some characters are replaced. They are always 6 characters longs and use only A-Z a-z 0-9 - _ and @.
|
||||
|
||||
### Directory structure
|
||||
|
||||
Here is the directory structure of Shaarli and the purpose of the different files:
|
||||
|
||||
```
|
||||
index.php : Main program.
|
||||
application/ : Shaarli classes
|
||||
├── LinkDB.php
|
||||
└── Utils.php
|
||||
tests/ : Shaarli unitary & functional tests
|
||||
├── LinkDBTest.php
|
||||
├── utils # utilities to ease testing
|
||||
│ └── ReferenceLinkDB.php
|
||||
└── UtilsTest.php
|
||||
COPYING : Shaarli license.
|
||||
inc/ : Includes (libraries, CSS…)
|
||||
├── awesomplete.*: tags autocompletion library
|
||||
├── blazy.*: picture wall lazy image loading library
|
||||
├── shaarli.css, reset.css : Shaarli stylesheet.
|
||||
├── qr.* : qr code generation library
|
||||
└──rain.tpl.class.php : RainTPL templating library.
|
||||
tpl/ : RainTPL templates for Shaarli. They are used to build the pages.
|
||||
images/ : Images and icons used in Shaarli.
|
||||
data/ : Directory where data is stored (bookmark database, configuration, logs, banlist…)
|
||||
├── config.php : Shaarli configuration (login, password, timezone, title…)
|
||||
├── datastore.php : Your link database (compressed).
|
||||
├── ipban.php : IP address ban system data.
|
||||
├── lastupdatecheck.txt : Update check timestamp file (used to check every 24 hours if a new version of Shaarli is available).
|
||||
└──log.txt : login/IPban log.
|
||||
cache/ : Directory containing the thumbnails cache. This directory is automatically created. You can erase it anytime you want.
|
||||
tmp/ : Temporary directory for compiled RainTPL templates. This directory is automatically created. You can erase it anytime you want.
|
||||
```
|
||||
|
||||
### Development
|
||||
|
||||
* [Contributing to Shaarli](https://github.com/shaarli/Shaarli/tree/master/CONTRIBUTING.md)
|
||||
* [Running unit tests](Running-unit-tests)
|
||||
* Patches should try to stick to the [PHP Standard Recommendations](http://www.php-fig.org/psr/) (PSR), especially:
|
||||
* [PSR-1](http://www.php-fig.org/psr/psr-1/) - Basic Coding Standard
|
||||
* [PSR-2](http://www.php-fig.org/psr/psr-2/) - Coding Style Guide
|
||||
|
||||
### Why not use a real database ? Files are slow !
|
||||
|
||||
Does browsing [this page](http://sebsauvage.net/links/) feel slow ? Try browsing older pages, too.
|
||||
|
||||
It's not slow at all, is it ? And don't forget the database contains more than 16000 links, and it's on a shared host, with 32000 visitors/day for my website alone. And it's still damn fast. Why ?
|
||||
|
||||
The data file is only 3.7 Mb. It's read 99% of the time, and is probably already in the operation system disk cache. So generating a page involves no I/O at all most of the time.
|
||||
|
||||
# Wiki - TODO
|
||||
* translate (new page can be called Home.fr, Home.es ... and linked from Home)
|
||||
* add more screenshots
|
||||
* add developer documentation (storage architecture, classes and functions, security handling, ...)
|
499
doc/Plugin-System.html
Normal file
499
doc/Plugin-System.html
Normal file
|
@ -0,0 +1,499 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>Shaarli - Plugin System</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<style type="text/css">
|
||||
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
|
||||
margin: 0; padding: 0; vertical-align: baseline; border: none; }
|
||||
table.sourceCode { width: 100%; line-height: 100%; }
|
||||
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
|
||||
td.sourceCode { padding-left: 5px; }
|
||||
code > span.kw { color: #007020; font-weight: bold; }
|
||||
code > span.dt { color: #902000; }
|
||||
code > span.dv { color: #40a070; }
|
||||
code > span.bn { color: #40a070; }
|
||||
code > span.fl { color: #40a070; }
|
||||
code > span.ch { color: #4070a0; }
|
||||
code > span.st { color: #4070a0; }
|
||||
code > span.co { color: #60a0b0; font-style: italic; }
|
||||
code > span.ot { color: #007020; }
|
||||
code > span.al { color: #ff0000; font-weight: bold; }
|
||||
code > span.fu { color: #06287e; }
|
||||
code > span.er { color: #ff0000; font-weight: bold; }
|
||||
</style>
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="plugin-system">Plugin System</h1>
|
||||
<blockquote>
|
||||
<p>Note: Plugin current status - in developpement (not merged into master).</p>
|
||||
</blockquote>
|
||||
<p><a href="#plugin-user-guide"><strong>I am a user.</strong> Plugin User Guide.</a><a href=".html"></a></p>
|
||||
<p><a href="#developper-api"><strong>I am a developper.</strong> Developper API.</a><a href=".html"></a></p>
|
||||
<p><a href="#guide-for-template-designer"><strong>I am a template designer.</strong> Guide for template designer.</a><a href=".html"></a></p>
|
||||
<h2 id="plugin-user-guide">Plugin User Guide</h2>
|
||||
<h3 id="manage-plugins">Manage plugins</h3>
|
||||
<p>In <code>config.php</code>, change $GLOBALS<a href="'ENABLED_PLUGINS']-array:.html">'config'['ENABLED_PLUGINS'] array:</a></p>
|
||||
<pre class="sourceCode php"><code class="sourceCode php"><span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'ENABLED_PLUGINS'</span><span class="ot">]](</span><span class="st">'ENABLED_PLUGINS'</span><span class="ot">]</span>.html<span class="ot">)</span></code></pre>
|
||||
<p>Full list:</p>
|
||||
<pre class="sourceCode php"><code class="sourceCode php"><span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'ENABLED_PLUGINS'</span><span class="ot">]</span> = <span class="fu">array</span><span class="ot">(](</span><span class="st">'ENABLED_PLUGINS'</span><span class="ot">]</span>-=-<span class="fu">array</span><span class="ot">(</span>.html<span class="ot">)</span>
|
||||
<span class="st">'qrcode'</span><span class="ot">,</span> <span class="st">'archiveorg'</span><span class="ot">,</span> <span class="st">'readityourself'</span><span class="ot">,</span> <span class="st">'playvideos'</span><span class="ot">,</span>
|
||||
<span class="st">'wallabag'</span><span class="ot">,</span> <span class="st">'markdown'</span><span class="ot">,</span> <span class="st">'addlink_toolbar'</span><span class="ot">,</span>
|
||||
<span class="ot">);</span></code></pre>
|
||||
<h3 id="list-of-plugins">List of plugins</h3>
|
||||
<p>Plugin maintained by the community:</p>
|
||||
<ul>
|
||||
<li>Archive.org - add a clickable icon to every link to archive.org.</li>
|
||||
<li>Addlink in toolbar - add a field to paste new links URL in toolbar.</li>
|
||||
<li>Markdown - write and display Shaare in Markdown.</li>
|
||||
<li>Play videos - popup to play all videos displayed in linklist.</li>
|
||||
<li>QRCode - add a clickable icon generating a QRCode for every link.</li>
|
||||
<li>ReadItYourself - add a clickable icon for ReadItYourself.</li>
|
||||
<li>Wallabag - add a clickable icon for Wallabag.</li>
|
||||
</ul>
|
||||
<h2 id="developper-api">Developper API</h2>
|
||||
<h3 id="what-can-i-do-with-plugins">What can I do with plugins?</h3>
|
||||
<p>The plugin system let you:</p>
|
||||
<ul>
|
||||
<li>insert content into specific places across templates.</li>
|
||||
<li>alter data before templates rendering.</li>
|
||||
<li>alter data before saving new links.</li>
|
||||
</ul>
|
||||
<h3 id="how-can-i-create-a-plugin-for-shaarli">How can I create a plugin for Shaarli?</h3>
|
||||
<p>First, chose a plugin name, such as <code>demo_plugin</code>.</p>
|
||||
<p>Under <code>plugin</code> folder, create a folder named with your plugin name. Then create a <plugin_name>.php file in that folder.</p>
|
||||
<p>You should have the following tree view:</p>
|
||||
<pre><code>| index.php
|
||||
| plugins/
|
||||
|---| demo_plugin/
|
||||
| |---| demo_plugin.php</code></pre>
|
||||
<h3 id="understanding-hooks">Understanding hooks</h3>
|
||||
<p>A plugin is a set of functions. Each function will be triggered by the plugin system at certain point in Shaarli execution.</p>
|
||||
<p>These functions need to be named with this pattern:</p>
|
||||
<pre><code>hook_<plugin_name>_<hook_name></code></pre>
|
||||
<p>For exemple, if my plugin want to add data to the header, this function is needed:</p>
|
||||
<pre><code>hook_demo_plugin_render_header()</code></pre>
|
||||
<p>If this function is declared, and the plugin enabled, it will be called every time Shaarli is rendering the header.</p>
|
||||
<h3 id="plugins-data">Plugin's data</h3>
|
||||
<h4 id="parameters">Parameters</h4>
|
||||
<p>Every hook function has a <code>$data</code> parameter. Its content differs for each hooks.</p>
|
||||
<p><strong>This parameter needs to be returned every time</strong>, otherwise data is lost.</p>
|
||||
<pre><code>return $data;</code></pre>
|
||||
<h4 id="filling-templates-placeholder">Filling templates placeholder</h4>
|
||||
<p>Template placeholders are displayed in template in specific places.</p>
|
||||
<p>RainTPL displays every element contained in the placeholder's array. These element can be added by plugins.</p>
|
||||
<p>For example, let's add a value in the placeholder <code>top_placeholder</code> which is displayed at the top of my page:</p>
|
||||
<pre class="sourceCode php"><code class="sourceCode php"><span class="kw">$data</span><span class="ot">[</span><span class="st">'top_placeholder'</span><span class="ot">[]</span> = <span class="st">'My content'</span><span class="ot">;](]</span>-=-<span class="st">'My-content'</span><span class="ot">;</span>.html<span class="ot">)</span>
|
||||
<span class="co"># OR</span>
|
||||
<span class="fu">array_push</span><span class="ot">(</span><span class="kw">$data</span><span class="ot">[</span><span class="st">'top_placeholder'</span><span class="ot">],</span> <span class="st">'My'</span><span class="ot">,</span> <span class="st">'content'</span><span class="ot">);[](</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="kw">return</span> <span class="kw">$data</span><span class="ot">;</span></code></pre>
|
||||
<h4 id="data-manipulation">Data manipulation</h4>
|
||||
<p>When a page is displayed, every variable send to the template engine is passed to plugins before that in <code>$data</code>.</p>
|
||||
<p>The data contained by this array can be altered before template rendering.</p>
|
||||
<p>For exemple, in linklist, it is possible to alter every title:</p>
|
||||
<pre class="sourceCode php"><code class="sourceCode php"><span class="co">// mind the reference if you want $data to be altered</span>
|
||||
<span class="kw">foreach</span> <span class="ot">(</span><span class="kw">$data</span><span class="ot">[</span><span class="st">'links'</span><span class="ot">]</span> <span class="kw">as</span> &<span class="kw">$value</span><span class="ot">)</span> {<span class="ot">[](</span>.html<span class="ot">)</span>
|
||||
<span class="co">// String reverse every title.</span>
|
||||
<span class="kw">$value</span><span class="ot">[</span><span class="st">'title'</span><span class="ot">]</span> = <span class="fu">strrev</span><span class="ot">(</span><span class="kw">$value</span><span class="ot">[</span><span class="st">'title'</span><span class="ot">]);[](</span>.html<span class="ot">)</span>
|
||||
}
|
||||
|
||||
<span class="kw">return</span> <span class="kw">$data</span><span class="ot">;</span></code></pre>
|
||||
<h3 id="its-not-working">It's not working!</h3>
|
||||
<p>Use <code>demo_plugin</code> as a functional example. It covers most of the plugin system features.</p>
|
||||
<p>If it's still not working, please <a href="https://github.com/shaarli/Shaarli/issues/new">open an issue</a>.<a href=".html"></a></p>
|
||||
<h3 id="hooks">Hooks</h3>
|
||||
<table>
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th style="text-align: left;">Hooks</th>
|
||||
<th style="text-align: center;">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;"><a href="#render_header">render_header</a></td>
|
||||
<td style="text-align: center;">Allow plugin to add content in page headers.</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;"><a href="#render_includes">render_includes</a></td>
|
||||
<td style="text-align: center;">Allow plugin to include their own CSS files.</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;"><a href="#render_footer">render_footer</a></td>
|
||||
<td style="text-align: center;">Allow plugin to add content in page footer and include their own JS files.</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;"><a href="#render_linklist">render_linklist</a></td>
|
||||
<td style="text-align: center;">It allows to add content at the begining and end of the page, after every link displayed and to alter link data.</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;"><a href="#render_editlink">render_editlink</a></td>
|
||||
<td style="text-align: center;">Allow to add fields in the form, or display elements.</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;"><a href="#render_tools">render_tools</a></td>
|
||||
<td style="text-align: center;">Allow to add content at the end of the page.</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;"><a href="#render_picwall">render_picwall</a></td>
|
||||
<td style="text-align: center;">Allow to add content at the top and bottom of the page.</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;"><a href="#render_tagcloud">render_tagcloud</a></td>
|
||||
<td style="text-align: center;">Allow to add content at the top and bottom of the page.</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;"><a href="#render_daily">render_daily</a></td>
|
||||
<td style="text-align: center;">Allow to add content at the top and bottom of the page, the bottom of each link and to alter data.</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;"><a href="#savelink">savelink</a></td>
|
||||
<td style="text-align: center;">Allow to alter the link being saved in the datastore.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4 id="render_header">render_header</h4>
|
||||
<p>Triggered on every page.</p>
|
||||
<p>Allow plugin to add content in page headers.</p>
|
||||
<h5 id="data">Data</h5>
|
||||
<p><code>$data</code> is an array containing:</p>
|
||||
<ul>
|
||||
<li><code>_PAGE_</code>: current target page (eg: <code>linklist</code>, <code>picwall</code>, etc.).</li>
|
||||
<li><code>_LOGGEDIN_</code>: true if user is logged in, false otherwise.</li>
|
||||
</ul>
|
||||
<h5 id="template-placeholders">Template placeholders</h5>
|
||||
<p>Items can be displayed in templates by adding an entry in <code>$data['<placeholder>']</code> array.<a href=".html"></a></p>
|
||||
<p>List of placeholders:</p>
|
||||
<ul>
|
||||
<li><code>buttons_toolbar</code>: after the list of buttons in the header.</li>
|
||||
</ul>
|
||||
<p><img src="http://i.imgur.com/ssJUOrt.png" alt="buttons_toolbar_example" /><a href=".html"></a></p>
|
||||
<ul>
|
||||
<li><code>fields_toolbar</code>: after search fields in the header.</li>
|
||||
</ul>
|
||||
<blockquote>
|
||||
<p>Note: This will only be called in linklist.</p>
|
||||
</blockquote>
|
||||
<p><img src="http://i.imgur.com/3GMifI2.png" alt="fields_toolbar_example" /><a href=".html"></a></p>
|
||||
<h4 id="render_includes">render_includes</h4>
|
||||
<p>Triggered on every page.</p>
|
||||
<p>Allow plugin to include their own CSS files.</p>
|
||||
<h5 id="data-1">Data</h5>
|
||||
<p><code>$data</code> is an array containing:</p>
|
||||
<ul>
|
||||
<li><code>_PAGE_</code>: current target page (eg: <code>linklist</code>, <code>picwall</code>, etc.).</li>
|
||||
<li><code>_LOGGEDIN_</code>: true if user is logged in, false otherwise.</li>
|
||||
</ul>
|
||||
<h5 id="template-placeholders-1">Template placeholders</h5>
|
||||
<p>Items can be displayed in templates by adding an entry in <code>$data['<placeholder>']</code> array.<a href=".html"></a></p>
|
||||
<p>List of placeholders:</p>
|
||||
<ul>
|
||||
<li><code>css_files</code>: called after loading default CSS.</li>
|
||||
</ul>
|
||||
<blockquote>
|
||||
<p>Note: only add the path of the CSS file. E.g: <code>plugins/demo_plugin/custom_demo.css</code>.</p>
|
||||
</blockquote>
|
||||
<h4 id="render_footer">render_footer</h4>
|
||||
<p>Triggered on every page.</p>
|
||||
<p>Allow plugin to add content in page footer and include their own JS files.</p>
|
||||
<h5 id="data-2">Data</h5>
|
||||
<p><code>$data</code> is an array containing:</p>
|
||||
<ul>
|
||||
<li><code>_PAGE_</code>: current target page (eg: <code>linklist</code>, <code>picwall</code>, etc.).</li>
|
||||
<li><code>_LOGGEDIN_</code>: true if user is logged in, false otherwise.</li>
|
||||
</ul>
|
||||
<h5 id="template-placeholders-2">Template placeholders</h5>
|
||||
<p>Items can be displayed in templates by adding an entry in <code>$data['<placeholder>']</code> array.<a href=".html"></a></p>
|
||||
<p>List of placeholders:</p>
|
||||
<ul>
|
||||
<li><code>text</code>: called after the end of the footer text.</li>
|
||||
</ul>
|
||||
<p><img src="http://i.imgur.com/L5S2YEH.png" alt="text_example" /><a href=".html"></a></p>
|
||||
<ul>
|
||||
<li><code>js_files</code>: called at the end of the page, to include custom JS scripts.</li>
|
||||
</ul>
|
||||
<blockquote>
|
||||
<p>Note: only add the path of the JS file. E.g: <code>plugins/demo_plugin/custom_demo.js</code>.</p>
|
||||
</blockquote>
|
||||
<h4 id="render_linklist">render_linklist</h4>
|
||||
<p>Triggered when <code>linklist</code> is displayed (list of links, permalink, search, tag filtered, etc.).</p>
|
||||
<p>It allows to add content at the begining and end of the page, after every link displayed and to alter link data.</p>
|
||||
<h5 id="data-3">Data</h5>
|
||||
<p><code>$data</code> is an array containing:</p>
|
||||
<ul>
|
||||
<li><code>_LOGGEDIN_</code>: true if user is logged in, false otherwise.</li>
|
||||
<li>All templates data, including links.</li>
|
||||
</ul>
|
||||
<h5 id="template-placeholders-3">Template placeholders</h5>
|
||||
<p>Items can be displayed in templates by adding an entry in <code>$data['<placeholder>']</code> array.<a href=".html"></a></p>
|
||||
<p>List of placeholders:</p>
|
||||
<ul>
|
||||
<li><code>action_plugin</code>: next to the button "private only" at the top and bottom of the page.</li>
|
||||
</ul>
|
||||
<p><img src="http://i.imgur.com/Q12PWg0.png" alt="action_plugin_example" /><a href=".html"></a></p>
|
||||
<ul>
|
||||
<li><code>link_plugin</code>: for every link, between permalink and link URL.</li>
|
||||
</ul>
|
||||
<p><img src="http://i.imgur.com/3oDPhWx.png" alt="link_plugin_example" /><a href=".html"></a></p>
|
||||
<ul>
|
||||
<li><code>plugin_start_zone</code>: before displaying the template content.</li>
|
||||
</ul>
|
||||
<p><img src="http://i.imgur.com/OVBkGy3.png" alt="plugin_start_zone_example" /><a href=".html"></a></p>
|
||||
<ul>
|
||||
<li><code>plugin_end_zone</code>: after displaying the template content.</li>
|
||||
</ul>
|
||||
<p><img src="http://i.imgur.com/6IoRuop.png" alt="plugin_end_zone_example" /><a href=".html"></a></p>
|
||||
<h4 id="render_editlink">render_editlink</h4>
|
||||
<p>Triggered when the link edition form is displayed.</p>
|
||||
<p>Allow to add fields in the form, or display elements.</p>
|
||||
<h5 id="data-4">Data</h5>
|
||||
<p><code>$data</code> is an array containing:</p>
|
||||
<ul>
|
||||
<li>All templates data.</li>
|
||||
</ul>
|
||||
<h5 id="template-placeholders-4">Template placeholders</h5>
|
||||
<p>Items can be displayed in templates by adding an entry in <code>$data['<placeholder>']</code> array.<a href=".html"></a></p>
|
||||
<p>List of placeholders:</p>
|
||||
<ul>
|
||||
<li><code>edit_link_plugin</code>: after tags field.</li>
|
||||
</ul>
|
||||
<p><img src="http://i.imgur.com/5u17Ens.png" alt="edit_link_plugin_example" /><a href=".html"></a></p>
|
||||
<h4 id="render_tools">render_tools</h4>
|
||||
<p>Triggered when the "tools" page is displayed.</p>
|
||||
<p>Allow to add content at the end of the page.</p>
|
||||
<h5 id="data-5">Data</h5>
|
||||
<p><code>$data</code> is an array containing:</p>
|
||||
<ul>
|
||||
<li>All templates data.</li>
|
||||
</ul>
|
||||
<h5 id="template-placeholders-5">Template placeholders</h5>
|
||||
<p>Items can be displayed in templates by adding an entry in <code>$data['<placeholder>']</code> array.<a href=".html"></a></p>
|
||||
<p>List of placeholders:</p>
|
||||
<ul>
|
||||
<li><code>tools_plugin</code>: at the end of the page.</li>
|
||||
</ul>
|
||||
<p><img src="http://i.imgur.com/Bqhu9oQ.png" alt="tools_plugin_example" /><a href=".html"></a></p>
|
||||
<h4 id="render_picwall">render_picwall</h4>
|
||||
<p>Triggered when picwall is displayed.</p>
|
||||
<p>Allow to add content at the top and bottom of the page.</p>
|
||||
<h5 id="data-6">Data</h5>
|
||||
<p><code>$data</code> is an array containing:</p>
|
||||
<ul>
|
||||
<li><code>_LOGGEDIN_</code>: true if user is logged in, false otherwise.</li>
|
||||
<li>All templates data.</li>
|
||||
</ul>
|
||||
<h5 id="template-placeholders-6">Template placeholders</h5>
|
||||
<p>Items can be displayed in templates by adding an entry in <code>$data['<placeholder>']</code> array.<a href=".html"></a></p>
|
||||
<p>List of placeholders:</p>
|
||||
<ul>
|
||||
<li><p><code>plugin_start_zone</code>: before displaying the template content.</p></li>
|
||||
<li><p><code>plugin_end_zone</code>: after displaying the template content.</p></li>
|
||||
</ul>
|
||||
<p><img src="http://i.imgur.com/tVTQFER.png" alt="plugin_start_end_zone_example" /><a href=".html"></a></p>
|
||||
<h4 id="render_tagcloud">render_tagcloud</h4>
|
||||
<p>Triggered when tagcloud is displayed.</p>
|
||||
<p>Allow to add content at the top and bottom of the page.</p>
|
||||
<h5 id="data-7">Data</h5>
|
||||
<p><code>$data</code> is an array containing:</p>
|
||||
<ul>
|
||||
<li><code>_LOGGEDIN_</code>: true if user is logged in, false otherwise.</li>
|
||||
<li>All templates data.</li>
|
||||
</ul>
|
||||
<h5 id="template-placeholders-7">Template placeholders</h5>
|
||||
<p>Items can be displayed in templates by adding an entry in <code>$data['<placeholder>']</code> array.<a href=".html"></a></p>
|
||||
<p>List of placeholders:</p>
|
||||
<ul>
|
||||
<li><p><code>plugin_start_zone</code>: before displaying the template content.</p></li>
|
||||
<li><p><code>plugin_end_zone</code>: after displaying the template content.</p></li>
|
||||
</ul>
|
||||
<p><img src="http://i.imgur.com/vHmyT3a.png" alt="plugin_start_end_zone_example" /><a href=".html"></a></p>
|
||||
<h4 id="render_daily">render_daily</h4>
|
||||
<p>Triggered when tagcloud is displayed.</p>
|
||||
<p>Allow to add content at the top and bottom of the page, the bottom of each link and to alter data.</p>
|
||||
<h5 id="data-8">Data</h5>
|
||||
<p><code>$data</code> is an array containing:</p>
|
||||
<ul>
|
||||
<li><code>_LOGGEDIN_</code>: true if user is logged in, false otherwise.</li>
|
||||
<li>All templates data, including links.</li>
|
||||
</ul>
|
||||
<h5 id="template-placeholders-8">Template placeholders</h5>
|
||||
<p>Items can be displayed in templates by adding an entry in <code>$data['<placeholder>']</code> array.<a href=".html"></a></p>
|
||||
<p>List of placeholders:</p>
|
||||
<ul>
|
||||
<li><code>link_plugin</code>: used at bottom of each link.</li>
|
||||
</ul>
|
||||
<p><img src="http://i.imgur.com/hzhMfSZ.png" alt="link_plugin_example" /><a href=".html"></a></p>
|
||||
<ul>
|
||||
<li><p><code>plugin_start_zone</code>: before displaying the template content.</p></li>
|
||||
<li><p><code>plugin_end_zone</code>: after displaying the template content.</p></li>
|
||||
</ul>
|
||||
<h4 id="savelink">savelink</h4>
|
||||
<p>Triggered when a link is save (new link or edit).</p>
|
||||
<p>Allow to alter the link being saved in the datastore.</p>
|
||||
<h5 id="data-9">Data</h5>
|
||||
<p><code>$data</code> is an array containing the link being saved:</p>
|
||||
<ul>
|
||||
<li>title</li>
|
||||
<li>url</li>
|
||||
<li>description</li>
|
||||
<li>linkdate</li>
|
||||
<li>private</li>
|
||||
<li>tags</li>
|
||||
</ul>
|
||||
<h2 id="guide-for-template-designer">Guide for template designer</h2>
|
||||
<h3 id="placeholder-system">Placeholder system</h3>
|
||||
<p>In order to make plugins work with every custom themes, you need to add variable placeholder in your templates.</p>
|
||||
<p>It's a RainTPL loop like this:</p>
|
||||
<pre><code>{loop="$plugin_variable"}
|
||||
{$value}
|
||||
{/loop}</code></pre>
|
||||
<p>You should enable <code>demo_plugin</code> for testing purpose, since it uses every placeholder available.</p>
|
||||
<h3 id="list-of-placeholders">List of placeholders</h3>
|
||||
<p><strong>page.header.html</strong></p>
|
||||
<p>At the end of the menu:</p>
|
||||
<pre><code>{loop="$plugins_header.buttons_toolbar"}
|
||||
{$value}
|
||||
{/loop}</code></pre>
|
||||
<p><strong>includes.html</strong></p>
|
||||
<p>At the end of the file:</p>
|
||||
<pre class="sourceCode html"><code class="sourceCode html">{loop="$plugins_includes.css_files"}
|
||||
<span class="kw"><link</span><span class="ot"> type=</span><span class="st">"text/css"</span><span class="ot"> rel=</span><span class="st">"stylesheet"</span><span class="ot"> href=</span><span class="st">"{$value}#"</span><span class="kw">/></span>
|
||||
{/loop}</code></pre>
|
||||
<p><strong>page.footer.html</strong></p>
|
||||
<p>At the end of your footer notes:</p>
|
||||
<pre class="sourceCode html"><code class="sourceCode html">{loop="$plugins_footer.text"}
|
||||
{$value}
|
||||
{/loop}</code></pre>
|
||||
<p>At the end of file:</p>
|
||||
<pre class="sourceCode html"><code class="sourceCode html">{loop="$plugins_footer.js_files"}
|
||||
<span class="kw"><script</span><span class="ot"> src=</span><span class="st">"{$value}#"</span><span class="kw">></script></span>
|
||||
{/loop}</code></pre>
|
||||
<p><strong>linklist.html</strong></p>
|
||||
<p>After search fields:</p>
|
||||
<pre class="sourceCode html"><code class="sourceCode html">{loop="$plugins_header.fields_toolbar"}
|
||||
{$value}
|
||||
{/loop}</code></pre>
|
||||
<p>Before displaying the link list (after paging):</p>
|
||||
<pre class="sourceCode html"><code class="sourceCode html">{loop="$plugin_start_zone"}
|
||||
{$value}
|
||||
{/loop}</code></pre>
|
||||
<p>For every links (icons):</p>
|
||||
<pre class="sourceCode html"><code class="sourceCode html">{loop="$value.link_plugin"}
|
||||
<span class="kw"><span></span>{$value}<span class="kw"></span></span>
|
||||
{/loop}</code></pre>
|
||||
<p>Before end paging:</p>
|
||||
<pre class="sourceCode html"><code class="sourceCode html">{loop="$plugin_end_zone"}
|
||||
{$value}
|
||||
{/loop}</code></pre>
|
||||
<p><strong>linklist.paging.html</strong></p>
|
||||
<p>After the "private only" icon:</p>
|
||||
<pre class="sourceCode html"><code class="sourceCode html">{loop="$action_plugin"}
|
||||
{$value}
|
||||
{/loop}</code></pre>
|
||||
<p><strong>editlink.html</strong></p>
|
||||
<p>After tags field:</p>
|
||||
<pre class="sourceCode html"><code class="sourceCode html">{loop="$edit_link_plugin"}
|
||||
{$value}
|
||||
{/loop}</code></pre>
|
||||
<p><strong>tools.html</strong></p>
|
||||
<p>After the last tool:</p>
|
||||
<pre class="sourceCode html"><code class="sourceCode html">{loop="$tools_plugin"}
|
||||
{$value}
|
||||
{/loop}</code></pre>
|
||||
<p><strong>picwall.html</strong></p>
|
||||
<p>Top:</p>
|
||||
<pre class="sourceCode html"><code class="sourceCode html"><span class="kw"><div</span><span class="ot"> id=</span><span class="st">"plugin_zone_start_picwall"</span><span class="ot"> class=</span><span class="st">"plugin_zone"</span><span class="kw">></span>
|
||||
{loop="$plugin_start_zone"}
|
||||
{$value}
|
||||
{/loop}
|
||||
<span class="kw"></div></span></code></pre>
|
||||
<p>Bottom:</p>
|
||||
<pre class="sourceCode html"><code class="sourceCode html"><span class="kw"><div</span><span class="ot"> id=</span><span class="st">"plugin_zone_end_picwall"</span><span class="ot"> class=</span><span class="st">"plugin_zone"</span><span class="kw">></span>
|
||||
{loop="$plugin_end_zone"}
|
||||
{$value}
|
||||
{/loop}
|
||||
<span class="kw"></div></span></code></pre>
|
||||
<p><strong>tagcloud.html</strong></p>
|
||||
<p>Top:</p>
|
||||
<pre class="sourceCode html"><code class="sourceCode html"> <span class="kw"><div</span><span class="ot"> id=</span><span class="st">"plugin_zone_start_tagcloud"</span><span class="ot"> class=</span><span class="st">"plugin_zone"</span><span class="kw">></span>
|
||||
{loop="$plugin_start_zone"}
|
||||
{$value}
|
||||
{/loop}
|
||||
<span class="kw"></div></span></code></pre>
|
||||
<p>Bottom:</p>
|
||||
<pre class="sourceCode html"><code class="sourceCode html"> <span class="kw"><div</span><span class="ot"> id=</span><span class="st">"plugin_zone_end_tagcloud"</span><span class="ot"> class=</span><span class="st">"plugin_zone"</span><span class="kw">></span>
|
||||
{loop="$plugin_end_zone"}
|
||||
{$value}
|
||||
{/loop}
|
||||
<span class="kw"></div></span></code></pre>
|
||||
<p><strong>daily.html</strong></p>
|
||||
<p>Top:</p>
|
||||
<pre class="sourceCode html"><code class="sourceCode html"><span class="kw"><div</span><span class="ot"> id=</span><span class="st">"plugin_zone_start_picwall"</span><span class="ot"> class=</span><span class="st">"plugin_zone"</span><span class="kw">></span>
|
||||
{loop="$plugin_start_zone"}
|
||||
{$value}
|
||||
{/loop}
|
||||
<span class="kw"></div></span></code></pre>
|
||||
<p>After every link:</p>
|
||||
<pre class="sourceCode html"><code class="sourceCode html"><span class="kw"><div</span><span class="ot"> class=</span><span class="st">"dailyEntryFooter"</span><span class="kw">></span>
|
||||
{loop="$link.link_plugin"}
|
||||
{$value}
|
||||
{/loop}
|
||||
<span class="kw"></div></span></code></pre>
|
||||
<p>Bottom:</p>
|
||||
<pre class="sourceCode html"><code class="sourceCode html"><span class="kw"><div</span><span class="ot"> id=</span><span class="st">"plugin_zone_end_picwall"</span><span class="ot"> class=</span><span class="st">"plugin_zone"</span><span class="kw">></span>
|
||||
{loop="$plugin_end_zone"}
|
||||
{$value}
|
||||
{/loop}
|
||||
<span class="kw"></div></span></code></pre>
|
||||
</body>
|
||||
</html>
|
590
doc/Plugin-System.md
Normal file
590
doc/Plugin-System.md
Normal file
|
@ -0,0 +1,590 @@
|
|||
#Plugin System
|
||||
> Note: Plugin current status - in developpement (not merged into master).
|
||||
|
||||
[**I am a user.** Plugin User Guide.](#plugin-user-guide)[](.html)
|
||||
|
||||
[**I am a developper.** Developper API.](#developper-api)[](.html)
|
||||
|
||||
[**I am a template designer.** Guide for template designer.](#guide-for-template-designer)[](.html)
|
||||
|
||||
## Plugin User Guide
|
||||
|
||||
### Manage plugins
|
||||
|
||||
In `config.php`, change $GLOBALS['config'['ENABLED_PLUGINS'] array:]('ENABLED_PLUGINS']-array:.html)
|
||||
|
||||
```php
|
||||
$GLOBALS['config'['ENABLED_PLUGINS']]('ENABLED_PLUGINS'].html)
|
||||
```
|
||||
|
||||
Full list:
|
||||
|
||||
```php
|
||||
$GLOBALS['config'['ENABLED_PLUGINS'] = array(]('ENABLED_PLUGINS']-=-array(.html)
|
||||
'qrcode', 'archiveorg', 'readityourself', 'playvideos',
|
||||
'wallabag', 'markdown', 'addlink_toolbar',
|
||||
);
|
||||
```
|
||||
|
||||
### List of plugins
|
||||
|
||||
Plugin maintained by the community:
|
||||
|
||||
* Archive.org - add a clickable icon to every link to archive.org.
|
||||
* Addlink in toolbar - add a field to paste new links URL in toolbar.
|
||||
* Markdown - write and display Shaare in Markdown.
|
||||
* Play videos - popup to play all videos displayed in linklist.
|
||||
* QRCode - add a clickable icon generating a QRCode for every link.
|
||||
* ReadItYourself - add a clickable icon for ReadItYourself.
|
||||
* Wallabag - add a clickable icon for Wallabag.
|
||||
|
||||
## Developper API
|
||||
|
||||
### What can I do with plugins?
|
||||
|
||||
The plugin system let you:
|
||||
|
||||
* insert content into specific places across templates.
|
||||
* alter data before templates rendering.
|
||||
* alter data before saving new links.
|
||||
|
||||
### How can I create a plugin for Shaarli?
|
||||
|
||||
First, chose a plugin name, such as `demo_plugin`.
|
||||
|
||||
Under `plugin` folder, create a folder named with your plugin name. Then create a <plugin_name>.php file in that folder.
|
||||
|
||||
You should have the following tree view:
|
||||
|
||||
```
|
||||
| index.php
|
||||
| plugins/
|
||||
|---| demo_plugin/
|
||||
| |---| demo_plugin.php
|
||||
```
|
||||
|
||||
### Understanding hooks
|
||||
|
||||
A plugin is a set of functions. Each function will be triggered by the plugin system at certain point in Shaarli execution.
|
||||
|
||||
These functions need to be named with this pattern:
|
||||
|
||||
```
|
||||
hook_<plugin_name>_<hook_name>
|
||||
```
|
||||
|
||||
For exemple, if my plugin want to add data to the header, this function is needed:
|
||||
|
||||
hook_demo_plugin_render_header()
|
||||
|
||||
If this function is declared, and the plugin enabled, it will be called every time Shaarli is rendering the header.
|
||||
|
||||
### Plugin's data
|
||||
|
||||
#### Parameters
|
||||
|
||||
Every hook function has a `$data` parameter. Its content differs for each hooks.
|
||||
|
||||
**This parameter needs to be returned every time**, otherwise data is lost.
|
||||
|
||||
return $data;
|
||||
|
||||
#### Filling templates placeholder
|
||||
|
||||
Template placeholders are displayed in template in specific places.
|
||||
|
||||
RainTPL displays every element contained in the placeholder's array. These element can be added by plugins.
|
||||
|
||||
For example, let's add a value in the placeholder `top_placeholder` which is displayed at the top of my page:
|
||||
|
||||
```php
|
||||
$data['top_placeholder'[] = 'My content';](]-=-'My-content';.html)
|
||||
# OR
|
||||
array_push($data['top_placeholder'], 'My', 'content');[](.html)
|
||||
|
||||
return $data;
|
||||
```
|
||||
|
||||
#### Data manipulation
|
||||
|
||||
When a page is displayed, every variable send to the template engine is passed to plugins before that in `$data`.
|
||||
|
||||
The data contained by this array can be altered before template rendering.
|
||||
|
||||
For exemple, in linklist, it is possible to alter every title:
|
||||
|
||||
```php
|
||||
// mind the reference if you want $data to be altered
|
||||
foreach ($data['links'] as &$value) {[](.html)
|
||||
// String reverse every title.
|
||||
$value['title'] = strrev($value['title']);[](.html)
|
||||
}
|
||||
|
||||
return $data;
|
||||
```
|
||||
|
||||
### It's not working!
|
||||
|
||||
Use `demo_plugin` as a functional example. It covers most of the plugin system features.
|
||||
|
||||
If it's still not working, please [open an issue](https://github.com/shaarli/Shaarli/issues/new).[](.html)
|
||||
|
||||
### Hooks
|
||||
|
||||
| Hooks | Description |
|
||||
| ------------- |:-------------:|
|
||||
| [render_header](#render_header) | Allow plugin to add content in page headers. |[](.html)
|
||||
| [render_includes](#render_includes) | Allow plugin to include their own CSS files. |[](.html)
|
||||
| [render_footer](#render_footer) | Allow plugin to add content in page footer and include their own JS files. | [](.html)
|
||||
| [render_linklist](#render_linklist) | It allows to add content at the begining and end of the page, after every link displayed and to alter link data. |[](.html)
|
||||
| [render_editlink](#render_editlink) | Allow to add fields in the form, or display elements. |[](.html)
|
||||
| [render_tools](#render_tools) | Allow to add content at the end of the page. |[](.html)
|
||||
| [render_picwall](#render_picwall) | Allow to add content at the top and bottom of the page. |[](.html)
|
||||
| [render_tagcloud](#render_tagcloud) | Allow to add content at the top and bottom of the page. |[](.html)
|
||||
| [render_daily](#render_daily) | Allow to add content at the top and bottom of the page, the bottom of each link and to alter data. |[](.html)
|
||||
| [savelink](#savelink) | Allow to alter the link being saved in the datastore. |[](.html)
|
||||
|
||||
|
||||
#### render_header
|
||||
|
||||
Triggered on every page.
|
||||
|
||||
Allow plugin to add content in page headers.
|
||||
|
||||
##### Data
|
||||
|
||||
`$data` is an array containing:
|
||||
|
||||
* `_PAGE_`: current target page (eg: `linklist`, `picwall`, etc.).
|
||||
* `_LOGGEDIN_`: true if user is logged in, false otherwise.
|
||||
|
||||
##### Template placeholders
|
||||
|
||||
Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.[](.html)
|
||||
|
||||
List of placeholders:
|
||||
|
||||
* `buttons_toolbar`: after the list of buttons in the header.
|
||||
|
||||
![buttons_toolbar_example](http://i.imgur.com/ssJUOrt.png)[](.html)
|
||||
|
||||
* `fields_toolbar`: after search fields in the header.
|
||||
|
||||
> Note: This will only be called in linklist.
|
||||
|
||||
![fields_toolbar_example](http://i.imgur.com/3GMifI2.png)[](.html)
|
||||
|
||||
#### render_includes
|
||||
|
||||
Triggered on every page.
|
||||
|
||||
Allow plugin to include their own CSS files.
|
||||
|
||||
##### Data
|
||||
|
||||
`$data` is an array containing:
|
||||
|
||||
* `_PAGE_`: current target page (eg: `linklist`, `picwall`, etc.).
|
||||
* `_LOGGEDIN_`: true if user is logged in, false otherwise.
|
||||
|
||||
##### Template placeholders
|
||||
|
||||
Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.[](.html)
|
||||
|
||||
List of placeholders:
|
||||
|
||||
* `css_files`: called after loading default CSS.
|
||||
|
||||
> Note: only add the path of the CSS file. E.g: `plugins/demo_plugin/custom_demo.css`.
|
||||
|
||||
#### render_footer
|
||||
|
||||
Triggered on every page.
|
||||
|
||||
Allow plugin to add content in page footer and include their own JS files.
|
||||
|
||||
##### Data
|
||||
|
||||
`$data` is an array containing:
|
||||
|
||||
* `_PAGE_`: current target page (eg: `linklist`, `picwall`, etc.).
|
||||
* `_LOGGEDIN_`: true if user is logged in, false otherwise.
|
||||
|
||||
##### Template placeholders
|
||||
|
||||
Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.[](.html)
|
||||
|
||||
List of placeholders:
|
||||
|
||||
* `text`: called after the end of the footer text.
|
||||
|
||||
![text_example](http://i.imgur.com/L5S2YEH.png)[](.html)
|
||||
|
||||
* `js_files`: called at the end of the page, to include custom JS scripts.
|
||||
|
||||
> Note: only add the path of the JS file. E.g: `plugins/demo_plugin/custom_demo.js`.
|
||||
|
||||
#### render_linklist
|
||||
|
||||
Triggered when `linklist` is displayed (list of links, permalink, search, tag filtered, etc.).
|
||||
|
||||
It allows to add content at the begining and end of the page, after every link displayed and to alter link data.
|
||||
|
||||
##### Data
|
||||
|
||||
`$data` is an array containing:
|
||||
|
||||
* `_LOGGEDIN_`: true if user is logged in, false otherwise.
|
||||
* All templates data, including links.
|
||||
|
||||
##### Template placeholders
|
||||
|
||||
Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.[](.html)
|
||||
|
||||
List of placeholders:
|
||||
|
||||
* `action_plugin`: next to the button "private only" at the top and bottom of the page.
|
||||
|
||||
![action_plugin_example](http://i.imgur.com/Q12PWg0.png)[](.html)
|
||||
|
||||
* `link_plugin`: for every link, between permalink and link URL.
|
||||
|
||||
![link_plugin_example](http://i.imgur.com/3oDPhWx.png)[](.html)
|
||||
|
||||
* `plugin_start_zone`: before displaying the template content.
|
||||
|
||||
![plugin_start_zone_example](http://i.imgur.com/OVBkGy3.png)[](.html)
|
||||
|
||||
* `plugin_end_zone`: after displaying the template content.
|
||||
|
||||
![plugin_end_zone_example](http://i.imgur.com/6IoRuop.png)[](.html)
|
||||
|
||||
#### render_editlink
|
||||
|
||||
Triggered when the link edition form is displayed.
|
||||
|
||||
Allow to add fields in the form, or display elements.
|
||||
|
||||
##### Data
|
||||
|
||||
`$data` is an array containing:
|
||||
|
||||
* All templates data.
|
||||
|
||||
##### Template placeholders
|
||||
|
||||
Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.[](.html)
|
||||
|
||||
List of placeholders:
|
||||
|
||||
* `edit_link_plugin`: after tags field.
|
||||
|
||||
![edit_link_plugin_example](http://i.imgur.com/5u17Ens.png)[](.html)
|
||||
|
||||
#### render_tools
|
||||
|
||||
Triggered when the "tools" page is displayed.
|
||||
|
||||
Allow to add content at the end of the page.
|
||||
|
||||
##### Data
|
||||
|
||||
`$data` is an array containing:
|
||||
|
||||
* All templates data.
|
||||
|
||||
##### Template placeholders
|
||||
|
||||
Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.[](.html)
|
||||
|
||||
List of placeholders:
|
||||
|
||||
* `tools_plugin`: at the end of the page.
|
||||
|
||||
![tools_plugin_example](http://i.imgur.com/Bqhu9oQ.png)[](.html)
|
||||
|
||||
#### render_picwall
|
||||
|
||||
Triggered when picwall is displayed.
|
||||
|
||||
Allow to add content at the top and bottom of the page.
|
||||
|
||||
##### Data
|
||||
|
||||
`$data` is an array containing:
|
||||
|
||||
* `_LOGGEDIN_`: true if user is logged in, false otherwise.
|
||||
* All templates data.
|
||||
|
||||
##### Template placeholders
|
||||
|
||||
Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.[](.html)
|
||||
|
||||
List of placeholders:
|
||||
|
||||
* `plugin_start_zone`: before displaying the template content.
|
||||
|
||||
* `plugin_end_zone`: after displaying the template content.
|
||||
|
||||
![plugin_start_end_zone_example](http://i.imgur.com/tVTQFER.png)[](.html)
|
||||
|
||||
#### render_tagcloud
|
||||
|
||||
Triggered when tagcloud is displayed.
|
||||
|
||||
Allow to add content at the top and bottom of the page.
|
||||
|
||||
##### Data
|
||||
|
||||
`$data` is an array containing:
|
||||
|
||||
* `_LOGGEDIN_`: true if user is logged in, false otherwise.
|
||||
* All templates data.
|
||||
|
||||
##### Template placeholders
|
||||
|
||||
Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.[](.html)
|
||||
|
||||
List of placeholders:
|
||||
|
||||
* `plugin_start_zone`: before displaying the template content.
|
||||
|
||||
* `plugin_end_zone`: after displaying the template content.
|
||||
|
||||
![plugin_start_end_zone_example](http://i.imgur.com/vHmyT3a.png)[](.html)
|
||||
|
||||
#### render_daily
|
||||
|
||||
Triggered when tagcloud is displayed.
|
||||
|
||||
Allow to add content at the top and bottom of the page, the bottom of each link and to alter data.
|
||||
|
||||
##### Data
|
||||
|
||||
`$data` is an array containing:
|
||||
|
||||
* `_LOGGEDIN_`: true if user is logged in, false otherwise.
|
||||
* All templates data, including links.
|
||||
|
||||
##### Template placeholders
|
||||
|
||||
Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.[](.html)
|
||||
|
||||
List of placeholders:
|
||||
|
||||
* `link_plugin`: used at bottom of each link.
|
||||
|
||||
![link_plugin_example](http://i.imgur.com/hzhMfSZ.png)[](.html)
|
||||
|
||||
* `plugin_start_zone`: before displaying the template content.
|
||||
|
||||
* `plugin_end_zone`: after displaying the template content.
|
||||
|
||||
#### savelink
|
||||
|
||||
Triggered when a link is save (new link or edit).
|
||||
|
||||
Allow to alter the link being saved in the datastore.
|
||||
|
||||
##### Data
|
||||
|
||||
`$data` is an array containing the link being saved:
|
||||
|
||||
* title
|
||||
* url
|
||||
* description
|
||||
* linkdate
|
||||
* private
|
||||
* tags
|
||||
|
||||
## Guide for template designer
|
||||
|
||||
### Placeholder system
|
||||
|
||||
In order to make plugins work with every custom themes, you need to add variable placeholder in your templates.
|
||||
|
||||
It's a RainTPL loop like this:
|
||||
|
||||
{loop="$plugin_variable"}
|
||||
{$value}
|
||||
{/loop}
|
||||
|
||||
You should enable `demo_plugin` for testing purpose, since it uses every placeholder available.
|
||||
|
||||
### List of placeholders
|
||||
|
||||
**page.header.html**
|
||||
|
||||
At the end of the menu:
|
||||
|
||||
{loop="$plugins_header.buttons_toolbar"}
|
||||
{$value}
|
||||
{/loop}
|
||||
|
||||
**includes.html**
|
||||
|
||||
At the end of the file:
|
||||
|
||||
```html
|
||||
{loop="$plugins_includes.css_files"}
|
||||
<link type="text/css" rel="stylesheet" href="{$value}#"/>
|
||||
{/loop}
|
||||
```
|
||||
|
||||
**page.footer.html**
|
||||
|
||||
At the end of your footer notes:
|
||||
|
||||
```html
|
||||
{loop="$plugins_footer.text"}
|
||||
{$value}
|
||||
{/loop}
|
||||
```
|
||||
|
||||
At the end of file:
|
||||
|
||||
```html
|
||||
{loop="$plugins_footer.js_files"}
|
||||
<script src="{$value}#"></script>
|
||||
{/loop}
|
||||
```
|
||||
|
||||
**linklist.html**
|
||||
|
||||
After search fields:
|
||||
|
||||
```html
|
||||
{loop="$plugins_header.fields_toolbar"}
|
||||
{$value}
|
||||
{/loop}
|
||||
```
|
||||
|
||||
Before displaying the link list (after paging):
|
||||
|
||||
```html
|
||||
{loop="$plugin_start_zone"}
|
||||
{$value}
|
||||
{/loop}
|
||||
```
|
||||
|
||||
For every links (icons):
|
||||
|
||||
```html
|
||||
{loop="$value.link_plugin"}
|
||||
<span>{$value}</span>
|
||||
{/loop}
|
||||
```
|
||||
|
||||
Before end paging:
|
||||
|
||||
```html
|
||||
{loop="$plugin_end_zone"}
|
||||
{$value}
|
||||
{/loop}
|
||||
```
|
||||
|
||||
**linklist.paging.html**
|
||||
|
||||
After the "private only" icon:
|
||||
|
||||
```html
|
||||
{loop="$action_plugin"}
|
||||
{$value}
|
||||
{/loop}
|
||||
```
|
||||
|
||||
**editlink.html**
|
||||
|
||||
After tags field:
|
||||
|
||||
```html
|
||||
{loop="$edit_link_plugin"}
|
||||
{$value}
|
||||
{/loop}
|
||||
```
|
||||
|
||||
**tools.html**
|
||||
|
||||
After the last tool:
|
||||
|
||||
```html
|
||||
{loop="$tools_plugin"}
|
||||
{$value}
|
||||
{/loop}
|
||||
```
|
||||
|
||||
**picwall.html**
|
||||
|
||||
Top:
|
||||
|
||||
```html
|
||||
<div id="plugin_zone_start_picwall" class="plugin_zone">
|
||||
{loop="$plugin_start_zone"}
|
||||
{$value}
|
||||
{/loop}
|
||||
</div>
|
||||
```
|
||||
|
||||
Bottom:
|
||||
|
||||
```html
|
||||
<div id="plugin_zone_end_picwall" class="plugin_zone">
|
||||
{loop="$plugin_end_zone"}
|
||||
{$value}
|
||||
{/loop}
|
||||
</div>
|
||||
```
|
||||
|
||||
**tagcloud.html**
|
||||
|
||||
Top:
|
||||
|
||||
```html
|
||||
<div id="plugin_zone_start_tagcloud" class="plugin_zone">
|
||||
{loop="$plugin_start_zone"}
|
||||
{$value}
|
||||
{/loop}
|
||||
</div>
|
||||
```
|
||||
|
||||
Bottom:
|
||||
|
||||
```html
|
||||
<div id="plugin_zone_end_tagcloud" class="plugin_zone">
|
||||
{loop="$plugin_end_zone"}
|
||||
{$value}
|
||||
{/loop}
|
||||
</div>
|
||||
```
|
||||
|
||||
**daily.html**
|
||||
|
||||
Top:
|
||||
|
||||
```html
|
||||
<div id="plugin_zone_start_picwall" class="plugin_zone">
|
||||
{loop="$plugin_start_zone"}
|
||||
{$value}
|
||||
{/loop}
|
||||
</div>
|
||||
```
|
||||
|
||||
After every link:
|
||||
|
||||
```html
|
||||
<div class="dailyEntryFooter">
|
||||
{loop="$link.link_plugin"}
|
||||
{$value}
|
||||
{/loop}
|
||||
</div>
|
||||
```
|
||||
|
||||
Bottom:
|
||||
|
||||
```html
|
||||
<div id="plugin_zone_end_picwall" class="plugin_zone">
|
||||
{loop="$plugin_end_zone"}
|
||||
{$value}
|
||||
{/loop}
|
||||
</div>
|
||||
```
|
75
doc/RSS-feeds.html
Normal file
75
doc/RSS-feeds.html
Normal file
|
@ -0,0 +1,75 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>Shaarli - RSS feeds</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="rss-feeds">RSS feeds</h1>
|
||||
<h3 id="rss-feeds-or-picture-wall-for-a-specific-searchtag">RSS Feeds or Picture Wall for a specific search/tag</h3>
|
||||
<p>It is possible to filter RSS/ATOM feeds and Picture Wall on a Shaarli to <strong>only display results of a specific search, or for a specific tag</strong>.</p>
|
||||
<p>For example, if you want to subscribe only to links tagged <code>photography</code>:</p>
|
||||
<ul>
|
||||
<li>Go to the desired Shaarli instance.</li>
|
||||
<li>Search for the <code>photography</code> tag in the <em>Filter by tag</em> box. Links tagged <code>photography</code> are displayed.</li>
|
||||
<li>Click on the <code>RSS Feed</code> button.</li>
|
||||
<li>You are presented with an RSS feed showing only these links. Subscribe to it to receive only updates with this tag.</li>
|
||||
<li>The same method <strong>also works for a full-text search</strong> (<em>Search</em> box) <strong>and for the Picture Wall</strong> (want to only see pictures about <code>nature</code>?)</li>
|
||||
<li>You can also build the URLs manually:
|
||||
<ul>
|
||||
<li><code>https://my.shaarli.domain/?do=rss&searchtags=nature</code></li>
|
||||
<li><code>https://my.shaarli.domain/links/?do=picwall&searchterm=poney</code></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
<p><embed src="(images/rss-filter-1.png)-!.html" />(images/rss-filter-2.png)</p>
|
||||
</body>
|
||||
</html>
|
15
doc/RSS-feeds.md
Normal file
15
doc/RSS-feeds.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
#RSS feeds
|
||||
### RSS Feeds or Picture Wall for a specific search/tag
|
||||
It is possible to filter RSS/ATOM feeds and Picture Wall on a Shaarli to **only display results of a specific search, or for a specific tag**.
|
||||
|
||||
For example, if you want to subscribe only to links tagged `photography`:
|
||||
- Go to the desired Shaarli instance.
|
||||
- Search for the `photography` tag in the _Filter by tag_ box. Links tagged `photography` are displayed.
|
||||
- Click on the `RSS Feed` button.
|
||||
- You are presented with an RSS feed showing only these links. Subscribe to it to receive only updates with this tag.
|
||||
- The same method **also works for a full-text search** (_Search_ box) **and for the Picture Wall** (want to only see pictures about `nature`?)
|
||||
- You can also build the URLs manually:
|
||||
- `https://my.shaarli.domain/?do=rss&searchtags=nature`
|
||||
- `https://my.shaarli.domain/links/?do=picwall&searchterm=poney`
|
||||
|
||||
![(images/rss-filter-1.png) !]((images/rss-filter-1.png)-!.html)(images/rss-filter-2.png)
|
107
doc/Security.html
Normal file
107
doc/Security.html
Normal file
|
@ -0,0 +1,107 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>Shaarli - Security</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<style type="text/css">
|
||||
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
|
||||
margin: 0; padding: 0; vertical-align: baseline; border: none; }
|
||||
table.sourceCode { width: 100%; line-height: 100%; }
|
||||
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
|
||||
td.sourceCode { padding-left: 5px; }
|
||||
code > span.kw { color: #007020; font-weight: bold; }
|
||||
code > span.dt { color: #902000; }
|
||||
code > span.dv { color: #40a070; }
|
||||
code > span.bn { color: #40a070; }
|
||||
code > span.fl { color: #40a070; }
|
||||
code > span.ch { color: #4070a0; }
|
||||
code > span.st { color: #4070a0; }
|
||||
code > span.co { color: #60a0b0; font-style: italic; }
|
||||
code > span.ot { color: #007020; }
|
||||
code > span.al { color: #ff0000; font-weight: bold; }
|
||||
code > span.fu { color: #06287e; }
|
||||
code > span.er { color: #ff0000; font-weight: bold; }
|
||||
</style>
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="security">Security</h1>
|
||||
<h2 id="client-browser">Client browser</h2>
|
||||
<ul>
|
||||
<li>Shaarli relies on <code>HTTP_REFERER</code> for some functions (like redirects and clicking on tags). If you have disabled or masqueraded <code>HTTP_REFERER</code> in your browser, some features of Shaarli may not work</li>
|
||||
</ul>
|
||||
<h2 id="php">PHP</h2>
|
||||
<ul>
|
||||
<li><code>magic_quotes</code> is an horrible option of PHP which is often activated on servers. No serious developer should rely on this horror to secure their code against SQL injections. You should disable it (and Shaarli expects this option to be disabled). Nevertheless, I have added code to cope with <code>magic_quotes</code> on, so you should not be bothered even on crappy hosts.</li>
|
||||
</ul>
|
||||
<h2 id="server-and-sessions">Server and sessions</h2>
|
||||
<ul>
|
||||
<li>Directories are protected using <code>.htaccess</code> files</li>
|
||||
<li>Forms are protected against XSRF (Cross-site requests forgery):</li>
|
||||
<li>Forms which act on data (save,delete…) contain a token generated by the server.</li>
|
||||
<li>Any posted form which does not contain a valid token is rejected.</li>
|
||||
<li>Any token can only be used once.</li>
|
||||
<li>Tokens are attached to the session and cannot be reused in another session.</li>
|
||||
<li>Sessions automatically expire after 60 minutes.</li>
|
||||
<li>Sessions are protected against hijacking: the session ID cannot be used from a different IP address.</li>
|
||||
</ul>
|
||||
<h2 id="shaarli-datastore-and-configuration">Shaarli datastore and configuration</h2>
|
||||
<ul>
|
||||
<li>The password is salted, hashed and stored in the data subdirectory, in a PHP file, and protected by htaccess. Even if the webserver does not support htaccess, the hash is not readable by URL. Even if the .php file is stolen, the password cannot deduced from the hash. The salt prevents rainbow-tables attacks.</li>
|
||||
<li>Links are stored as an associative array which is serialized, compressed (with deflate), base64-encoded and saved as a comment in a <code>.php</code> file.</li>
|
||||
<li>Even if the server does not support <code>.htaccess</code> files, the data file will still not be readable by URL.</li>
|
||||
<li><p>The database looks like this:</p>
|
||||
<pre class="sourceCode php"><code class="sourceCode php"><span class="kw"><?php</span> <span class="co">/* zP1ZjxxJtiYIvvevEPJ2lDOaLrZv7o...</span>
|
||||
<span class="co">...ka7gaco/Z+TFXM2i7BlfMf8qxpaSSYfKlvqv/x8= */</span> <span class="kw">?></span></code></pre></li>
|
||||
<li><p>Small hashes are used to make a link to an entry in Shaarli. They are unique. In fact, the date of the items (eg. <code>20110923_150523</code>) is hashed with CRC32, then converted to base64 and some characters are replaced. They are always 6 characters longs and use only <code>A-Z a-z 0-9 - _</code> and <code>@</code>.</p></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
28
doc/Security.md
Normal file
28
doc/Security.md
Normal file
|
@ -0,0 +1,28 @@
|
|||
#Security
|
||||
## Client browser
|
||||
* Shaarli relies on `HTTP_REFERER` for some functions (like redirects and clicking on tags). If you have disabled or masqueraded `HTTP_REFERER` in your browser, some features of Shaarli may not work
|
||||
|
||||
## PHP
|
||||
* `magic_quotes` is an horrible option of PHP which is often activated on servers. No serious developer should rely on this horror to secure their code against SQL injections. You should disable it (and Shaarli expects this option to be disabled). Nevertheless, I have added code to cope with `magic_quotes` on, so you should not be bothered even on crappy hosts.
|
||||
|
||||
## Server and sessions
|
||||
* Directories are protected using `.htaccess` files
|
||||
* Forms are protected against XSRF (Cross-site requests forgery):
|
||||
* Forms which act on data (save,delete…) contain a token generated by the server.
|
||||
* Any posted form which does not contain a valid token is rejected.
|
||||
* Any token can only be used once.
|
||||
* Tokens are attached to the session and cannot be reused in another session.
|
||||
* Sessions automatically expire after 60 minutes.
|
||||
* Sessions are protected against hijacking: the session ID cannot be used from a different IP address.
|
||||
|
||||
## Shaarli datastore and configuration
|
||||
* The password is salted, hashed and stored in the data subdirectory, in a PHP file, and protected by htaccess. Even if the webserver does not support htaccess, the hash is not readable by URL. Even if the .php file is stolen, the password cannot deduced from the hash. The salt prevents rainbow-tables attacks.
|
||||
* Links are stored as an associative array which is serialized, compressed (with deflate), base64-encoded and saved as a comment in a `.php` file.
|
||||
* Even if the server does not support `.htaccess` files, the data file will still not be readable by URL.
|
||||
* The database looks like this:
|
||||
```php
|
||||
<?php /* zP1ZjxxJtiYIvvevEPJ2lDOaLrZv7o...
|
||||
...ka7gaco/Z+TFXM2i7BlfMf8qxpaSSYfKlvqv/x8= */ ?>
|
||||
```
|
||||
|
||||
* Small hashes are used to make a link to an entry in Shaarli. They are unique. In fact, the date of the items (eg. `20110923_150523`) is hashed with CRC32, then converted to base64 and some characters are replaced. They are always 6 characters longs and use only `A-Z a-z 0-9 - _` and `@`.
|
371
doc/Server-configuration.html
Normal file
371
doc/Server-configuration.html
Normal file
|
@ -0,0 +1,371 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>Shaarli - Server configuration</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<style type="text/css">
|
||||
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
|
||||
margin: 0; padding: 0; vertical-align: baseline; border: none; }
|
||||
table.sourceCode { width: 100%; line-height: 100%; }
|
||||
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
|
||||
td.sourceCode { padding-left: 5px; }
|
||||
code > span.kw { color: #007020; font-weight: bold; }
|
||||
code > span.dt { color: #902000; }
|
||||
code > span.dv { color: #40a070; }
|
||||
code > span.bn { color: #40a070; }
|
||||
code > span.fl { color: #40a070; }
|
||||
code > span.ch { color: #4070a0; }
|
||||
code > span.st { color: #4070a0; }
|
||||
code > span.co { color: #60a0b0; font-style: italic; }
|
||||
code > span.ot { color: #007020; }
|
||||
code > span.al { color: #ff0000; font-weight: bold; }
|
||||
code > span.fu { color: #06287e; }
|
||||
code > span.er { color: #ff0000; font-weight: bold; }
|
||||
</style>
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="server-configuration">Server configuration</h1>
|
||||
<p><em>Example virtual host configurations for popular web servers</em></p>
|
||||
<ul>
|
||||
<li><a href="#apache">Apache</a><a href=".html"></a></li>
|
||||
<li><a href="#lighthttpd">LightHttpd</a> (empty)<a href=".html"></a></li>
|
||||
<li><a href="#nginx">Nginx</a><a href=".html"></a></li>
|
||||
</ul>
|
||||
<h2 id="prerequisites">Prerequisites</h2>
|
||||
<ul>
|
||||
<li>Shaarli is installed in a directory readable/writeable by the user</li>
|
||||
<li>the correct read/write permissions have been granted to the web server <em>user and/or group</em></li>
|
||||
<li>for HTTPS / SSL:</li>
|
||||
<li>a key pair (public, private) and a certificate have been generated</li>
|
||||
<li>the appropriate server SSL extension is installed and active</li>
|
||||
</ul>
|
||||
<p>Related guides:</p>
|
||||
<ul>
|
||||
<li><a href="http://www.xenocafe.com/tutorials/linux/centos/openssl/self_signed_certificates/index.php">How to Create Self-Signed SSL Certificates with OpenSSL</a><a href=".html"></a></li>
|
||||
<li><a href="https://workaround.org/certificate-authority">How do I create my own Certificate Authority?</a><a href=".html"></a></li>
|
||||
</ul>
|
||||
<h2 id="apache">Apache</h2>
|
||||
<h3 id="minimal">Minimal</h3>
|
||||
<pre class="sourceCode apache"><code class="sourceCode apache"><span class="fu"><VirtualHost</span><span class="ot"> *:80</span><span class="fu">></span>
|
||||
ServerName<span class="st"> shaarli.my-domain.org</span>
|
||||
DocumentRoot<span class="st"> /absolute/path/to/shaarli/</span>
|
||||
<span class="fu"></VirtualHost></span></code></pre>
|
||||
<h3 id="debug---log-all-the-things">Debug - Log all the things!</h3>
|
||||
<p>This configuration will log both Apache and PHP errors, which may prove useful to identify server configuration errors.</p>
|
||||
<p>See:</p>
|
||||
<ul>
|
||||
<li><a href="http://stackoverflow.com/q/176">Apache/PHP - error log per VirtualHost</a> (StackOverflow)<a href=".html"></a></li>
|
||||
<li><a href="PHP:%20php_value%20vs%20php_admin_value%20and%20the%20use%20of%20php_flag%20explained">PHP: php_value vs php_admin_value and the use of php_flag explained</a><a href=".html"></a></li>
|
||||
</ul>
|
||||
<pre class="sourceCode apache"><code class="sourceCode apache"><span class="fu"><VirtualHost</span><span class="ot"> *:80</span><span class="fu">></span>
|
||||
ServerName<span class="st"> shaarli.my-domain.org</span>
|
||||
DocumentRoot<span class="st"> /absolute/path/to/shaarli/</span>
|
||||
|
||||
<span class="ot">LogLevel</span><span class="ch"> </span><span class="kw">warn</span>
|
||||
ErrorLog<span class="st"> /var/log/apache2/shaarli-error.log</span>
|
||||
CustomLog<span class="st"> /var/log/apache2/shaarli-access.log combined</span>
|
||||
|
||||
php_flag log_errors on
|
||||
php_flag display_errors on
|
||||
php_value error_reporting 2147483647
|
||||
php_value error_log /var/log/apache2/shaarli-php-error.log
|
||||
<span class="fu"></VirtualHost></span></code></pre>
|
||||
<h3 id="standard---keep-access-and-error-logs">Standard - Keep access and error logs</h3>
|
||||
<pre class="sourceCode apache"><code class="sourceCode apache"><span class="fu"><VirtualHost</span><span class="ot"> *:80</span><span class="fu">></span>
|
||||
ServerName<span class="st"> shaarli.my-domain.org</span>
|
||||
DocumentRoot<span class="st"> /absolute/path/to/shaarli/</span>
|
||||
|
||||
<span class="ot">LogLevel</span><span class="ch"> </span><span class="kw">warn</span>
|
||||
ErrorLog<span class="st"> /var/log/apache2/shaarli-error.log</span>
|
||||
CustomLog<span class="st"> /var/log/apache2/shaarli-access.log combined</span>
|
||||
<span class="fu"></VirtualHost></span></code></pre>
|
||||
<h3 id="paranoid---redirect-http-80-to-https-443">Paranoid - Redirect HTTP (:80) to HTTPS (:443)</h3>
|
||||
<p>See <a href="https://wiki.mozilla.org/Security/Server_Side_TLS#Apache">Server-side TLS</a> (Mozilla).<a href=".html"></a></p>
|
||||
<pre class="sourceCode apache"><code class="sourceCode apache"><span class="fu"><VirtualHost</span><span class="ot"> *:443</span><span class="fu">></span>
|
||||
ServerName<span class="st"> shaarli.my-domain.org</span>
|
||||
DocumentRoot<span class="st"> /absolute/path/to/shaarli/</span>
|
||||
|
||||
<span class="ot">SSLEngine</span><span class="ch"> </span><span class="kw">on</span>
|
||||
SSLCertificateFile<span class="st"> /absolute/path/to/the/website/certificate.crt</span>
|
||||
SSLCertificateKeyFile<span class="st"> /absolute/path/to/the/website/key.key</span>
|
||||
|
||||
<span class="fu"><Directory</span><span class="ot"> /absolute/path/to/shaarli/</span><span class="fu">></span>
|
||||
<span class="ot">AllowOverride</span><span class="ch"> </span><span class="kw">All</span>
|
||||
<span class="ot">Options</span><span class="ch"> </span><span class="kw">Indexes</span><span class="ch"> </span><span class="kw">FollowSymLinks</span><span class="ch"> </span><span class="kw">MultiViews</span>
|
||||
<span class="ot">Order</span><span class="ch"> </span><span class="kw">allow,deny</span>
|
||||
allow<span class="st"> from all</span>
|
||||
<span class="fu"></Directory></span>
|
||||
|
||||
<span class="ot">LogLevel</span><span class="ch"> </span><span class="kw">warn</span>
|
||||
ErrorLog<span class="st"> /var/log/apache2/shaarli-error.log</span>
|
||||
CustomLog<span class="st"> /var/log/apache2/shaarli-access.log combined</span>
|
||||
<span class="fu"></VirtualHost></span>
|
||||
<span class="fu"><VirtualHost</span><span class="ot"> *:80</span><span class="fu">></span>
|
||||
ServerName<span class="st"> shaarli.my-domain.org</span>
|
||||
Redirect<span class="st"> 301 / https://shaarli.my-domain.org</span>
|
||||
|
||||
<span class="ot">LogLevel</span><span class="ch"> </span><span class="kw">warn</span>
|
||||
ErrorLog<span class="st"> /var/log/apache2/shaarli-error.log</span>
|
||||
CustomLog<span class="st"> /var/log/apache2/shaarli-access.log combined</span>
|
||||
<span class="fu"></VirtualHost></span></code></pre>
|
||||
<h2 id="lighthttpd">LightHttpd</h2>
|
||||
<h2 id="nginx">Nginx</h2>
|
||||
<h3 id="foreword">Foreword</h3>
|
||||
<p>Nginx does not natively interpret PHP scripts; to this effect, we will run a <a href="https://en.wikipedia.org/wiki/FastCGI">FastCGI</a> service, to which Nginx's FastCGI module will proxy all requests to PHP resources.<a href=".html"></a></p>
|
||||
<p>Required packages:</p>
|
||||
<ul>
|
||||
<li><a href="http://nginx.org">nginx</a><a href=".html"></a></li>
|
||||
<li><a href="http://php-fpm.org">php-fpm</a> - PHP FastCGI Process Manager<a href=".html"></a></li>
|
||||
</ul>
|
||||
<p>Official documentation:</p>
|
||||
<ul>
|
||||
<li><a href="http://nginx.org/en/docs/beginners_guide.html">Beginner's guide</a><a href=".html"></a></li>
|
||||
<li><a href="http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html">ngx_http_fastcgi_module</a><a href=".html"></a></li>
|
||||
<li><a href="http://wiki.nginx.org/Pitfalls">Pitfalls</a><a href=".html"></a></li>
|
||||
</ul>
|
||||
<p>Community resources:</p>
|
||||
<ul>
|
||||
<li><a href="https://wiki.mozilla.org/Security/Server_Side_TLS#Nginx">Server-side TLS (Nginx)</a> (Mozilla)<a href=".html"></a></li>
|
||||
<li><a href="http://kbeezie.com/nginx-configuration-examples/">PHP configuration examples</a> (Karl Blessing)<a href=".html"></a></li>
|
||||
</ul>
|
||||
<h3 id="common-setup">Common setup</h3>
|
||||
<p>Once Nginx and PHP-FPM are installed, we need to ensure:</p>
|
||||
<ul>
|
||||
<li>Nginx and PHP-FPM are running using the <em>same user and group</em></li>
|
||||
<li>both these user and group have
|
||||
<ul>
|
||||
<li><code>read</code> permissions for Shaarli resources</li>
|
||||
<li><code>execute</code> permissions for Shaarli directories <em>AND</em> their parent directories</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
<p>On a production server:</p>
|
||||
<ul>
|
||||
<li><code>user:group</code> will likely be <code>http:http</code>, <code>www:www</code> or <code>www-data:www-data</code></li>
|
||||
<li>files will be located under <code>/var/www</code>, <code>/var/http</code> or <code>/usr/share/nginx</code></li>
|
||||
</ul>
|
||||
<p>On a development server:</p>
|
||||
<ul>
|
||||
<li>files may be located in a user's home directory</li>
|
||||
<li>in this case, make sure both Nginx and PHP-FPM are running as the local user/group!</li>
|
||||
</ul>
|
||||
<p>For all following examples, a development configuration will be used:</p>
|
||||
<ul>
|
||||
<li><code>user:group = john:users</code>,</li>
|
||||
</ul>
|
||||
<p>which corresponds to the following service configuration:</p>
|
||||
<pre class="sourceCode ini"><code class="sourceCode ini"><span class="co">; /etc/php/php-fpm.conf</span>
|
||||
<span class="dt">user </span><span class="ot">=</span><span class="st"> john</span>
|
||||
<span class="dt">group </span><span class="ot">=</span><span class="st"> users</span>
|
||||
|
||||
<span class="kw">[...][]</span><span class="dt">(.html)</span>
|
||||
<span class="dt">listen.owner </span><span class="ot">=</span><span class="st"> john</span>
|
||||
<span class="dt">listen.group </span><span class="ot">=</span><span class="st"> users</span></code></pre>
|
||||
<pre class="nginx"><code># /etc/nginx/nginx.conf
|
||||
user john users;
|
||||
|
||||
http {
|
||||
[...][](.html)
|
||||
}</code></pre>
|
||||
<h3 id="minimal-1">Minimal</h3>
|
||||
<p><em>WARNING: Use for development only!</em></p>
|
||||
<pre class="nginx"><code>user john users;
|
||||
worker_processes 1;
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
keepalive_timeout 20;
|
||||
|
||||
index index.html index.php;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
root /home/john/web;
|
||||
|
||||
access_log /var/log/nginx/access.log;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
location /shaarli/ {
|
||||
access_log /var/log/nginx/shaarli.access.log;
|
||||
error_log /var/log/nginx/shaarli.error.log;
|
||||
}
|
||||
|
||||
location ~ (index)\.php$ {
|
||||
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi.conf;
|
||||
}
|
||||
}
|
||||
}</code></pre>
|
||||
<h3 id="modular">Modular</h3>
|
||||
<p>The previous setup is sufficient for development purposes, but has several major caveats:</p>
|
||||
<ul>
|
||||
<li>every content that does not match the PHP rule will be sent to client browsers:
|
||||
<ul>
|
||||
<li>dotfiles - in our case, <code>.htaccess</code></li>
|
||||
<li>temporary files, e.g. Vim or Emacs files: <code>index.php~</code></li>
|
||||
</ul></li>
|
||||
<li>asset / static resource caching is not optimized</li>
|
||||
<li>if serving several PHP sites, there will be a lot of duplication: <code>location /shaarli/</code>, <code>location /mysite/</code>, etc.</li>
|
||||
</ul>
|
||||
<p>To solve this, we will split Nginx configuration in several parts, that will be included when needed:</p>
|
||||
<pre class="nginx"><code># /etc/nginx/deny.conf
|
||||
location ~ /\. {
|
||||
# deny access to dotfiles
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
deny all;
|
||||
}
|
||||
|
||||
location ~ ~$ {
|
||||
# deny access to temp editor files, e.g. "script.php~"
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
deny all;
|
||||
}</code></pre>
|
||||
<pre class="nginx"><code># /etc/nginx/php.conf
|
||||
location ~ (index)\.php$ {
|
||||
# proxy PHP requests to PHP-FPM
|
||||
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi.conf;
|
||||
}</code></pre>
|
||||
<pre class="nginx"><code># /etc/nginx/static_assets.conf
|
||||
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
|
||||
expires max;
|
||||
add_header Pragma public;
|
||||
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
|
||||
}</code></pre>
|
||||
<pre class="nginx"><code># /etc/nginx/nginx.conf
|
||||
[...][](.html)
|
||||
|
||||
http {
|
||||
[...][](.html)
|
||||
|
||||
root /home/john/web;
|
||||
access_log /var/log/nginx/access.log;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
server {
|
||||
# virtual host for a first domain
|
||||
listen 80;
|
||||
server_name my.first.domain.org;
|
||||
|
||||
location /shaarli/ {
|
||||
access_log /var/log/nginx/shaarli.access.log;
|
||||
error_log /var/log/nginx/shaarli.error.log;
|
||||
}
|
||||
|
||||
include deny.conf;
|
||||
include static_assets.conf;
|
||||
include php.conf;
|
||||
}
|
||||
|
||||
server {
|
||||
# virtual host for a second domain
|
||||
listen 80;
|
||||
server_name second.domain.com;
|
||||
|
||||
location /minigal/ {
|
||||
access_log /var/log/nginx/minigal.access.log;
|
||||
error_log /var/log/nginx/minigal.error.log;
|
||||
}
|
||||
|
||||
include deny.conf;
|
||||
include static_assets.conf;
|
||||
include php.conf;
|
||||
}
|
||||
}</code></pre>
|
||||
<h3 id="redirect-http-to-https">Redirect HTTP to HTTPS</h3>
|
||||
<p>Assuming you have generated a (self-signed) key and certificate, and they are located under <code>/home/john/ssl/localhost.{key,crt}</code>, it is pretty straightforward to set an HTTP (:80) to HTTPS (:443) redirection to force SSL/TLS usage.</p>
|
||||
<pre class="nginx"><code># /etc/nginx/nginx.conf
|
||||
[...][](.html)
|
||||
|
||||
http {
|
||||
[...][](.html)
|
||||
|
||||
index index.html index.php;
|
||||
|
||||
root /home/john/web;
|
||||
access_log /var/log/nginx/access.log;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
return 301 https://localhost$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name localhost;
|
||||
|
||||
ssl_certificate /home/john/ssl/localhost.crt;
|
||||
ssl_certificate_key /home/john/ssl/localhost.key;
|
||||
|
||||
location /shaarli/ {
|
||||
access_log /var/log/nginx/shaarli.access.log;
|
||||
error_log /var/log/nginx/shaarli.error.log;
|
||||
}
|
||||
|
||||
include deny.conf;
|
||||
include static_assets.conf;
|
||||
include php.conf;
|
||||
}
|
||||
}</code></pre>
|
||||
</body>
|
||||
</html>
|
321
doc/Server-configuration.md
Normal file
321
doc/Server-configuration.md
Normal file
|
@ -0,0 +1,321 @@
|
|||
#Server configuration
|
||||
*Example virtual host configurations for popular web servers*
|
||||
|
||||
- [Apache](#apache)[](.html)
|
||||
- [LightHttpd](#lighthttpd) (empty)[](.html)
|
||||
- [Nginx](#nginx)[](.html)
|
||||
|
||||
## Prerequisites
|
||||
* Shaarli is installed in a directory readable/writeable by the user
|
||||
* the correct read/write permissions have been granted to the web server _user and/or group_
|
||||
* for HTTPS / SSL:
|
||||
* a key pair (public, private) and a certificate have been generated
|
||||
* the appropriate server SSL extension is installed and active
|
||||
|
||||
Related guides:
|
||||
* [How to Create Self-Signed SSL Certificates with OpenSSL](http://www.xenocafe.com/tutorials/linux/centos/openssl/self_signed_certificates/index.php)[](.html)
|
||||
* [How do I create my own Certificate Authority?](https://workaround.org/certificate-authority)[](.html)
|
||||
|
||||
## Apache
|
||||
### Minimal
|
||||
```apache
|
||||
<VirtualHost *:80>
|
||||
ServerName shaarli.my-domain.org
|
||||
DocumentRoot /absolute/path/to/shaarli/
|
||||
</VirtualHost>
|
||||
```
|
||||
### Debug - Log all the things!
|
||||
This configuration will log both Apache and PHP errors, which may prove useful to identify server configuration errors.
|
||||
|
||||
See:
|
||||
* [Apache/PHP - error log per VirtualHost](http://stackoverflow.com/q/176) (StackOverflow)[](.html)
|
||||
* [PHP: php_value vs php_admin_value and the use of php_flag explained](PHP: php_value vs php_admin_value and the use of php_flag explained)[](.html)
|
||||
|
||||
```apache
|
||||
<VirtualHost *:80>
|
||||
ServerName shaarli.my-domain.org
|
||||
DocumentRoot /absolute/path/to/shaarli/
|
||||
|
||||
LogLevel warn
|
||||
ErrorLog /var/log/apache2/shaarli-error.log
|
||||
CustomLog /var/log/apache2/shaarli-access.log combined
|
||||
|
||||
php_flag log_errors on
|
||||
php_flag display_errors on
|
||||
php_value error_reporting 2147483647
|
||||
php_value error_log /var/log/apache2/shaarli-php-error.log
|
||||
</VirtualHost>
|
||||
```
|
||||
|
||||
### Standard - Keep access and error logs
|
||||
```apache
|
||||
<VirtualHost *:80>
|
||||
ServerName shaarli.my-domain.org
|
||||
DocumentRoot /absolute/path/to/shaarli/
|
||||
|
||||
LogLevel warn
|
||||
ErrorLog /var/log/apache2/shaarli-error.log
|
||||
CustomLog /var/log/apache2/shaarli-access.log combined
|
||||
</VirtualHost>
|
||||
```
|
||||
|
||||
### Paranoid - Redirect HTTP (:80) to HTTPS (:443)
|
||||
See [Server-side TLS](https://wiki.mozilla.org/Security/Server_Side_TLS#Apache) (Mozilla).[](.html)
|
||||
|
||||
```apache
|
||||
<VirtualHost *:443>
|
||||
ServerName shaarli.my-domain.org
|
||||
DocumentRoot /absolute/path/to/shaarli/
|
||||
|
||||
SSLEngine on
|
||||
SSLCertificateFile /absolute/path/to/the/website/certificate.crt
|
||||
SSLCertificateKeyFile /absolute/path/to/the/website/key.key
|
||||
|
||||
<Directory /absolute/path/to/shaarli/>
|
||||
AllowOverride All
|
||||
Options Indexes FollowSymLinks MultiViews
|
||||
Order allow,deny
|
||||
allow from all
|
||||
</Directory>
|
||||
|
||||
LogLevel warn
|
||||
ErrorLog /var/log/apache2/shaarli-error.log
|
||||
CustomLog /var/log/apache2/shaarli-access.log combined
|
||||
</VirtualHost>
|
||||
<VirtualHost *:80>
|
||||
ServerName shaarli.my-domain.org
|
||||
Redirect 301 / https://shaarli.my-domain.org
|
||||
|
||||
LogLevel warn
|
||||
ErrorLog /var/log/apache2/shaarli-error.log
|
||||
CustomLog /var/log/apache2/shaarli-access.log combined
|
||||
</VirtualHost>
|
||||
```
|
||||
|
||||
## LightHttpd
|
||||
|
||||
## Nginx
|
||||
### Foreword
|
||||
Nginx does not natively interpret PHP scripts; to this effect, we will run a [FastCGI](https://en.wikipedia.org/wiki/FastCGI) service, to which Nginx's FastCGI module will proxy all requests to PHP resources.[](.html)
|
||||
|
||||
Required packages:
|
||||
- [nginx](http://nginx.org)[](.html)
|
||||
- [php-fpm](http://php-fpm.org) - PHP FastCGI Process Manager[](.html)
|
||||
|
||||
Official documentation:
|
||||
- [Beginner's guide](http://nginx.org/en/docs/beginners_guide.html)[](.html)
|
||||
- [ngx_http_fastcgi_module](http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html)[](.html)
|
||||
- [Pitfalls](http://wiki.nginx.org/Pitfalls)[](.html)
|
||||
|
||||
Community resources:
|
||||
- [Server-side TLS (Nginx)](https://wiki.mozilla.org/Security/Server_Side_TLS#Nginx) (Mozilla)[](.html)
|
||||
- [PHP configuration examples](http://kbeezie.com/nginx-configuration-examples/) (Karl Blessing)[](.html)
|
||||
|
||||
### Common setup
|
||||
Once Nginx and PHP-FPM are installed, we need to ensure:
|
||||
- Nginx and PHP-FPM are running using the _same user and group_
|
||||
- both these user and group have
|
||||
- `read` permissions for Shaarli resources
|
||||
- `execute` permissions for Shaarli directories _AND_ their parent directories
|
||||
|
||||
On a production server:
|
||||
- `user:group` will likely be `http:http`, `www:www` or `www-data:www-data`
|
||||
- files will be located under `/var/www`, `/var/http` or `/usr/share/nginx`
|
||||
|
||||
On a development server:
|
||||
- files may be located in a user's home directory
|
||||
- in this case, make sure both Nginx and PHP-FPM are running as the local user/group!
|
||||
|
||||
For all following examples, a development configuration will be used:
|
||||
- `user:group = john:users`,
|
||||
|
||||
which corresponds to the following service configuration:
|
||||
|
||||
```ini
|
||||
; /etc/php/php-fpm.conf
|
||||
user = john
|
||||
group = users
|
||||
|
||||
[...][](.html)
|
||||
listen.owner = john
|
||||
listen.group = users
|
||||
```
|
||||
|
||||
```nginx
|
||||
# /etc/nginx/nginx.conf
|
||||
user john users;
|
||||
|
||||
http {
|
||||
[...][](.html)
|
||||
}
|
||||
```
|
||||
|
||||
### Minimal
|
||||
_WARNING: Use for development only!_
|
||||
|
||||
```nginx
|
||||
user john users;
|
||||
worker_processes 1;
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
keepalive_timeout 20;
|
||||
|
||||
index index.html index.php;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
root /home/john/web;
|
||||
|
||||
access_log /var/log/nginx/access.log;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
location /shaarli/ {
|
||||
access_log /var/log/nginx/shaarli.access.log;
|
||||
error_log /var/log/nginx/shaarli.error.log;
|
||||
}
|
||||
|
||||
location ~ (index)\.php$ {
|
||||
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi.conf;
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Modular
|
||||
The previous setup is sufficient for development purposes, but has several major caveats:
|
||||
- every content that does not match the PHP rule will be sent to client browsers:
|
||||
- dotfiles - in our case, `.htaccess`
|
||||
- temporary files, e.g. Vim or Emacs files: `index.php~`
|
||||
- asset / static resource caching is not optimized
|
||||
- if serving several PHP sites, there will be a lot of duplication: `location /shaarli/`, `location /mysite/`, etc.
|
||||
|
||||
To solve this, we will split Nginx configuration in several parts, that will be included when needed:
|
||||
|
||||
```nginx
|
||||
# /etc/nginx/deny.conf
|
||||
location ~ /\. {
|
||||
# deny access to dotfiles
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
deny all;
|
||||
}
|
||||
|
||||
location ~ ~$ {
|
||||
# deny access to temp editor files, e.g. "script.php~"
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
deny all;
|
||||
}
|
||||
```
|
||||
|
||||
```nginx
|
||||
# /etc/nginx/php.conf
|
||||
location ~ (index)\.php$ {
|
||||
# proxy PHP requests to PHP-FPM
|
||||
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi.conf;
|
||||
}
|
||||
```
|
||||
|
||||
```nginx
|
||||
# /etc/nginx/static_assets.conf
|
||||
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
|
||||
expires max;
|
||||
add_header Pragma public;
|
||||
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
|
||||
}
|
||||
```
|
||||
|
||||
```nginx
|
||||
# /etc/nginx/nginx.conf
|
||||
[...][](.html)
|
||||
|
||||
http {
|
||||
[...][](.html)
|
||||
|
||||
root /home/john/web;
|
||||
access_log /var/log/nginx/access.log;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
server {
|
||||
# virtual host for a first domain
|
||||
listen 80;
|
||||
server_name my.first.domain.org;
|
||||
|
||||
location /shaarli/ {
|
||||
access_log /var/log/nginx/shaarli.access.log;
|
||||
error_log /var/log/nginx/shaarli.error.log;
|
||||
}
|
||||
|
||||
include deny.conf;
|
||||
include static_assets.conf;
|
||||
include php.conf;
|
||||
}
|
||||
|
||||
server {
|
||||
# virtual host for a second domain
|
||||
listen 80;
|
||||
server_name second.domain.com;
|
||||
|
||||
location /minigal/ {
|
||||
access_log /var/log/nginx/minigal.access.log;
|
||||
error_log /var/log/nginx/minigal.error.log;
|
||||
}
|
||||
|
||||
include deny.conf;
|
||||
include static_assets.conf;
|
||||
include php.conf;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Redirect HTTP to HTTPS
|
||||
Assuming you have generated a (self-signed) key and certificate, and they are located under `/home/john/ssl/localhost.{key,crt}`, it is pretty straightforward to set an HTTP (:80) to HTTPS (:443) redirection to force SSL/TLS usage.
|
||||
|
||||
```nginx
|
||||
# /etc/nginx/nginx.conf
|
||||
[...][](.html)
|
||||
|
||||
http {
|
||||
[...][](.html)
|
||||
|
||||
index index.html index.php;
|
||||
|
||||
root /home/john/web;
|
||||
access_log /var/log/nginx/access.log;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
return 301 https://localhost$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name localhost;
|
||||
|
||||
ssl_certificate /home/john/ssl/localhost.crt;
|
||||
ssl_certificate_key /home/john/ssl/localhost.key;
|
||||
|
||||
location /shaarli/ {
|
||||
access_log /var/log/nginx/shaarli.access.log;
|
||||
error_log /var/log/nginx/shaarli.error.log;
|
||||
}
|
||||
|
||||
include deny.conf;
|
||||
include static_assets.conf;
|
||||
include php.conf;
|
||||
}
|
||||
}
|
||||
```
|
132
doc/Server-requirements.html
Normal file
132
doc/Server-requirements.html
Normal file
|
@ -0,0 +1,132 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>Shaarli - Server requirements</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="server-requirements">Server requirements</h1>
|
||||
<h2 id="php">PHP</h2>
|
||||
<h3 id="release-information">Release information</h3>
|
||||
<ul>
|
||||
<li><a href="http://php.net/supported-versions.php">PHP: Supported versions</a><a href=".html"></a></li>
|
||||
<li><a href="http://php.net/eol.php">PHP: Unsupported versions</a> <em>(EOL - End Of Life)</em><a href=".html"></a></li>
|
||||
<li><a href="http://php.net/ChangeLog-5.php">PHP 5 Changelog</a><a href=".html"></a></li>
|
||||
<li><a href="https://bugs.php.net/">PHP: Bugs</a><a href=".html"></a></li>
|
||||
</ul>
|
||||
<h3 id="supported-versions">Supported versions</h3>
|
||||
<table>
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th style="text-align: center;">Version</th>
|
||||
<th style="text-align: center;">Status</th>
|
||||
<th style="text-align: center;">Shaarli compatibility</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td style="text-align: center;">5.6</td>
|
||||
<td style="text-align: center;">Supported</td>
|
||||
<td style="text-align: center;">:white_check_mark:</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: center;">5.5</td>
|
||||
<td style="text-align: center;">Supported</td>
|
||||
<td style="text-align: center;">:white_check_mark:</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: center;">5.4</td>
|
||||
<td style="text-align: center;">Supported</td>
|
||||
<td style="text-align: center;">:white_check_mark:</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: center;">5.3</td>
|
||||
<td style="text-align: center;">EOL: 2014-08-14</td>
|
||||
<td style="text-align: center;">:white_check_mark:</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>See also:</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/shaarli/Shaarli/blob/master/.travis.yml">Travis configuration</a><a href=".html"></a></li>
|
||||
</ul>
|
||||
<p>PHP 7.0 information:</p>
|
||||
<ul>
|
||||
<li><a href="http://php.net/archive/2015.php#id2015-07-10-4">Beta1 announcement</a><a href=".html"></a></li>
|
||||
<li><a href="https://wiki.php.net/todo/php70">TODOLIST</a><a href=".html"></a></li>
|
||||
<li><a href="https://bugs.php.net/search.php?limit=30&order_by=id&direction=DESC&cmd=display&status=Open&bug_type=All&phpver=7.0">Recent bugs</a><a href=".html"></a></li>
|
||||
<li><a href="http://git.php.net/?p=php-src.git;a=shortlog;h=refs/heads/PHP-7.0.0">Git repository</a><a href=".html"></a></li>
|
||||
</ul>
|
||||
<h3 id="extensions">Extensions</h3>
|
||||
<table>
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th style="text-align: left;">Extension</th>
|
||||
<th style="text-align: center;">Required?</th>
|
||||
<th style="text-align: left;">Usage</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;"><a href="http://php.net/manual/en/book.mbstring.php"><code>php-mbstring</code></a></td>
|
||||
<td style="text-align: center;">CentOS, Fedora, RHEL, Windows</td>
|
||||
<td style="text-align: left;">multibyte (Unicode) string support<a href=".html"></a></td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;"><a href="http://php.net/manual/en/book.image.php"><code>php-gd</code></a></td>
|
||||
<td style="text-align: center;">-</td>
|
||||
<td style="text-align: left;">thumbnail resizing<a href=".html"></a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
30
doc/Server-requirements.md
Normal file
30
doc/Server-requirements.md
Normal file
|
@ -0,0 +1,30 @@
|
|||
#Server requirements
|
||||
## PHP
|
||||
### Release information
|
||||
- [PHP: Supported versions](http://php.net/supported-versions.php)[](.html)
|
||||
- [PHP: Unsupported versions](http://php.net/eol.php) _(EOL - End Of Life)_[](.html)
|
||||
- [PHP 5 Changelog](http://php.net/ChangeLog-5.php)[](.html)
|
||||
- [PHP: Bugs](https://bugs.php.net/)[](.html)
|
||||
|
||||
### Supported versions
|
||||
Version | Status | Shaarli compatibility
|
||||
:---:|:---:|:---:
|
||||
5.6 | Supported | :white_check_mark:
|
||||
5.5 | Supported | :white_check_mark:
|
||||
5.4 | Supported | :white_check_mark:
|
||||
5.3 | EOL: 2014-08-14 | :white_check_mark:
|
||||
|
||||
See also:
|
||||
- [Travis configuration](https://github.com/shaarli/Shaarli/blob/master/.travis.yml)[](.html)
|
||||
|
||||
PHP 7.0 information:
|
||||
- [Beta1 announcement](http://php.net/archive/2015.php#id2015-07-10-4)[](.html)
|
||||
- [TODOLIST](https://wiki.php.net/todo/php70)[](.html)
|
||||
- [Recent bugs](https://bugs.php.net/search.php?limit=30&order_by=id&direction=DESC&cmd=display&status=Open&bug_type=All&phpver=7.0)[](.html)
|
||||
- [Git repository](http://git.php.net/?p=php-src.git;a=shortlog;h=refs/heads/PHP-7.0.0)[](.html)
|
||||
|
||||
### Extensions
|
||||
Extension | Required? | Usage
|
||||
---|:---:|---
|
||||
[`php-mbstring`](http://php.net/manual/en/book.mbstring.php) | CentOS, Fedora, RHEL, Windows | multibyte (Unicode) string support[](.html)
|
||||
[`php-gd`](http://php.net/manual/en/book.image.php) | - | thumbnail resizing[](.html)
|
221
doc/Shaarli-configuration.html
Normal file
221
doc/Shaarli-configuration.html
Normal file
|
@ -0,0 +1,221 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>Shaarli - Shaarli configuration</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<style type="text/css">
|
||||
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
|
||||
margin: 0; padding: 0; vertical-align: baseline; border: none; }
|
||||
table.sourceCode { width: 100%; line-height: 100%; }
|
||||
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
|
||||
td.sourceCode { padding-left: 5px; }
|
||||
code > span.kw { color: #007020; font-weight: bold; }
|
||||
code > span.dt { color: #902000; }
|
||||
code > span.dv { color: #40a070; }
|
||||
code > span.bn { color: #40a070; }
|
||||
code > span.fl { color: #40a070; }
|
||||
code > span.ch { color: #4070a0; }
|
||||
code > span.st { color: #4070a0; }
|
||||
code > span.co { color: #60a0b0; font-style: italic; }
|
||||
code > span.ot { color: #007020; }
|
||||
code > span.al { color: #ff0000; font-weight: bold; }
|
||||
code > span.fu { color: #06287e; }
|
||||
code > span.er { color: #ff0000; font-weight: bold; }
|
||||
</style>
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="shaarli-configuration">Shaarli configuration</h1>
|
||||
<h2 id="foreword">Foreword</h2>
|
||||
<p><strong>Do not edit configuration options in index.php! Your changes would be lost.</strong></p>
|
||||
<p>Once your Shaarli instance is installed, the file <code>data/config.php</code> is generated:</p>
|
||||
<ul>
|
||||
<li>it contains all settings, and can be edited to customize values</li>
|
||||
<li>its values override those defined in <code>index.php</code></li>
|
||||
</ul>
|
||||
<h2 id="file-and-directory-permissions">File and directory permissions</h2>
|
||||
<p>The server process running Shaarli must have:</p>
|
||||
<ul>
|
||||
<li><code>read</code> access to the following resources:
|
||||
<ul>
|
||||
<li>PHP scripts: <code>index.php</code>, <code>application/*.php</code></li>
|
||||
<li>3rd party PHP and Javascript libraries: <code>inc/*.php</code>, <code>inc\*.js</code></li>
|
||||
<li>static assets:
|
||||
<ul>
|
||||
<li>CSS stylesheets: <code>inc\*.css</code></li>
|
||||
<li><code>images\*</code></li>
|
||||
</ul></li>
|
||||
<li>RainTPL templates: <code>tpl\*.html</code></li>
|
||||
</ul></li>
|
||||
<li><code>read</code>, <code>write</code> and <code>execution</code> access to the following directories:
|
||||
<ul>
|
||||
<li><code>cache</code> - thumbnail cache</li>
|
||||
<li><code>data</code> - link data store, configuration options</li>
|
||||
<li><code>pagecache</code> - Atom/RSS feed cache</li>
|
||||
<li><code>tmp</code> - RainTPL page cache</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
<p>On a Linux distribution:</p>
|
||||
<ul>
|
||||
<li>the web server user will likely be <code>www</code> or <code>http</code> (for Apache2)</li>
|
||||
<li>it will be a member of a group of the same name: <code>www:www</code>, <code>http:http</code></li>
|
||||
<li>to give it access to Shaarli, either:
|
||||
<ul>
|
||||
<li>unzip Shaarli in the default web server location (usually <code>/var/www/</code>) and set the web server user as the owner</li>
|
||||
<li>put users in the same group as the web server, and set the appropriate access rights</li>
|
||||
</ul></li>
|
||||
<li>if you have a domain / subdomain to serve Shaarli, <a href="Server-configuration">configure the server</a> accordingly<a href=".html"></a></li>
|
||||
</ul>
|
||||
<h2 id="example-dataconfig.php">Example <code>data/config.php</code></h2>
|
||||
<pre class="sourceCode php"><code class="sourceCode php"><span class="kw"><?php</span>
|
||||
<span class="co">// User login</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'login'</span><span class="ot">]</span> = <span class="st">'<login>'</span><span class="ot">;[](</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// User password hash</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'hash'</span><span class="ot">]</span> = <span class="st">'200c452da46c2f889e5e48c49ef044bcacdcb095'</span><span class="ot">;[](</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// Password salt</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'salt'</span><span class="ot">]</span> = <span class="st">'13b654102321576033d8473b63a275a1bf94c0f0'</span><span class="ot">;</span> <span class="ot">[](</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// Local timezone</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'timezone'</span><span class="ot">]</span> = <span class="st">'Africa/Abidjan'</span><span class="ot">;[](</span>.html<span class="ot">)</span>
|
||||
<span class="fu">date_default_timezone_set</span><span class="ot">(</span><span class="st">'Africa/Abidjan'</span><span class="ot">);</span>
|
||||
|
||||
<span class="co">// Shaarli title</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'title'</span><span class="ot">]</span> = <span class="st">'My Little Shaarly'</span><span class="ot">;[](</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// Link the Shaarli title points to</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'titleLink'</span><span class="ot">]</span> = <span class="st">'?'</span><span class="ot">;[](</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// HTTP referer redirector</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'redirector'</span><span class="ot">]</span> = <span class="st">''</span><span class="ot">;[](</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// Disable session hijacking</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'disablesessionprotection'</span><span class="ot">]</span> = <span class="kw">false</span><span class="ot">;</span> <span class="ot">[](</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// Whether new links are private by default</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'privateLinkByDefault'</span><span class="ot">]</span> = <span class="kw">false</span><span class="ot">;[](</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// Subdirectory where Shaarli stores its data files.</span>
|
||||
<span class="co">// You can change it for better security.</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'DATADIR'</span><span class="ot">]</span> = <span class="st">'data'</span><span class="ot">;](</span><span class="st">'DATADIR'</span><span class="ot">]</span>-=-<span class="st">'data'</span><span class="ot">;</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// File used to store settings</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'CONFIG_FILE'</span><span class="ot">]</span> = <span class="st">'data/config.php'</span><span class="ot">;](</span><span class="st">'CONFIG_FILE'</span><span class="ot">]</span>-=-<span class="st">'data/config.php'</span><span class="ot">;</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// File containing the link database</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'DATASTORE'</span><span class="ot">]</span> = <span class="st">'data/datastore.php'</span><span class="ot">;](</span><span class="st">'DATASTORE'</span><span class="ot">]</span>-=-<span class="st">'data/datastore.php'</span><span class="ot">;</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// Number of links displayed per page</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'LINKS_PER_PAGE'</span><span class="ot">]</span> = <span class="dv">20</span><span class="ot">;](</span><span class="st">'LINKS_PER_PAGE'</span><span class="ot">]</span>-=-<span class="dv">20</span><span class="ot">;</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// File recording failed login attempts and IP bans</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'IPBANS_FILENAME'</span><span class="ot">]</span> = <span class="st">'data/ipbans.php'</span><span class="ot">;](</span><span class="st">'IPBANS_FILENAME'</span><span class="ot">]</span>-=-<span class="st">'data/ipbans.php'</span><span class="ot">;</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// Failed login attempts before being banned</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'BAN_AFTER'</span><span class="ot">]</span> = <span class="dv">4</span><span class="ot">;](</span><span class="st">'BAN_AFTER'</span><span class="ot">]</span>-=-<span class="dv">4</span><span class="ot">;</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// Duration of an IP ban, in seconds (30 minutes)</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'BAN_DURATION'</span><span class="ot">]</span> = <span class="dv">1800</span><span class="ot">;](</span><span class="st">'BAN_DURATION'</span><span class="ot">]</span>-=-<span class="dv">1800</span><span class="ot">;</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// If set to true, everyone will be able to add, edit and remove links,</span>
|
||||
<span class="co">// as well as change configuration</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'OPEN_SHAARLI'</span><span class="ot">]</span> = <span class="kw">false</span><span class="ot">;](</span><span class="st">'OPEN_SHAARLI'</span><span class="ot">]</span>-=-<span class="kw">false</span><span class="ot">;</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// Do not show link timestamps</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'HIDE_TIMESTAMPS'</span><span class="ot">]</span> = <span class="kw">false</span><span class="ot">;](</span><span class="st">'HIDE_TIMESTAMPS'</span><span class="ot">]</span>-=-<span class="kw">false</span><span class="ot">;</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// Set to false to disable local thumbnail cache, e.g. due to limited disk quotas</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'ENABLE_THUMBNAILS'</span><span class="ot">]</span> = <span class="kw">true</span><span class="ot">;](</span><span class="st">'ENABLE_THUMBNAILS'</span><span class="ot">]</span>-=-<span class="kw">true</span><span class="ot">;</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// Thumbnail cache directory</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'CACHEDIR'</span><span class="ot">]</span> = <span class="st">'cache'</span><span class="ot">;](</span><span class="st">'CACHEDIR'</span><span class="ot">]</span>-=-<span class="st">'cache'</span><span class="ot">;</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// Enable feed (rss, atom, dailyrss) cache</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'ENABLE_LOCALCACHE'</span><span class="ot">]</span> = <span class="kw">true</span><span class="ot">;](</span><span class="st">'ENABLE_LOCALCACHE'</span><span class="ot">]</span>-=-<span class="kw">true</span><span class="ot">;</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// Feed cache directory</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'PAGECACHE'</span><span class="ot">]</span> = <span class="st">'pagecache'</span><span class="ot">;](</span><span class="st">'PAGECACHE'</span><span class="ot">]</span>-=-<span class="st">'pagecache'</span><span class="ot">;</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// RainTPL cache directory (keep the trailing slash!)</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'RAINTPL_TMP'</span><span class="ot">]</span> = <span class="st">'tmp/'</span><span class="ot">;](</span><span class="st">'RAINTPL_TMP'</span><span class="ot">]</span>-=-<span class="st">'tmp/'</span><span class="ot">;</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// RainTPL template directory (keep the trailing slash!)</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'RAINTPL_TPL'</span><span class="ot">]</span> = <span class="st">'tpl/'</span><span class="ot">;](</span><span class="st">'RAINTPL_TPL'</span><span class="ot">]</span>-=-<span class="st">'tpl/'</span><span class="ot">;</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// Whether Shaarli checks for new releases at https://github.com/shaarli/Shaarli</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'ENABLE_UPDATECHECK'</span><span class="ot">]</span> = <span class="kw">true</span><span class="ot">;](</span><span class="st">'ENABLE_UPDATECHECK'</span><span class="ot">]</span>-=-<span class="kw">true</span><span class="ot">;</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// File to store the latest Shaarli version</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'UPDATECHECK_FILENAME'</span><span class="ot">]</span> = <span class="st">'data/lastupdatecheck.txt'</span><span class="ot">;](</span><span class="st">'UPDATECHECK_FILENAME'</span><span class="ot">]</span>-=-<span class="st">'data/lastupdatecheck.txt'</span><span class="ot">;</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// Delay between version checks (requires to be logged in) (24 hours)</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'UPDATECHECK_INTERVAL'</span><span class="ot">]</span> = <span class="dv">86400</span><span class="ot">;](</span><span class="st">'UPDATECHECK_INTERVAL'</span><span class="ot">]</span>-=-<span class="dv">86400</span><span class="ot">;</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// For each link, display a link to an archived version on archive.org</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'ARCHIVE_ORG'</span><span class="ot">]</span> = <span class="kw">false</span><span class="ot">;](</span><span class="st">'ARCHIVE_ORG'</span><span class="ot">]</span>-=-<span class="kw">false</span><span class="ot">;</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// The RSS item links point:</span>
|
||||
<span class="co">// true => directly to the link</span>
|
||||
<span class="co">// false => to the entry on Shaarli (permalink)</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'ENABLE_RSS_PERMALINKS'</span><span class="ot">]</span> = <span class="kw">true</span><span class="ot">;](</span><span class="st">'ENABLE_RSS_PERMALINKS'</span><span class="ot">]</span>-=-<span class="kw">true</span><span class="ot">;</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// Hide all links to non-logged users</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'HIDE_PUBLIC_LINKS'</span><span class="ot">]</span> = <span class="kw">false</span><span class="ot">;](</span><span class="st">'HIDE_PUBLIC_LINKS'</span><span class="ot">]</span>-=-<span class="kw">false</span><span class="ot">;</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'PUBSUBHUB_URL'</span><span class="ot">]</span> = <span class="st">''</span><span class="ot">;](</span><span class="st">'PUBSUBHUB_URL'</span><span class="ot">]</span>-=-<span class="st">''</span><span class="ot">;</span>.html<span class="ot">)</span>
|
||||
|
||||
<span class="co">// Show an ATOM Feed button next to the Subscribe (RSS) button.</span>
|
||||
<span class="co">// ATOM feeds are available at the address ?do=atom regardless of this option.</span>
|
||||
<span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'SHOW_ATOM'</span><span class="ot">]</span> = <span class="kw">false</span><span class="ot">;](</span><span class="st">'SHOW_ATOM'</span><span class="ot">]</span>-=-<span class="kw">false</span><span class="ot">;</span>.html<span class="ot">)</span>
|
||||
<span class="kw">?></span></code></pre>
|
||||
</body>
|
||||
</html>
|
137
doc/Shaarli-configuration.md
Normal file
137
doc/Shaarli-configuration.md
Normal file
|
@ -0,0 +1,137 @@
|
|||
#Shaarli configuration
|
||||
## Foreword
|
||||
|
||||
**Do not edit configuration options in index.php! Your changes would be lost.**
|
||||
|
||||
Once your Shaarli instance is installed, the file `data/config.php` is generated:
|
||||
* it contains all settings, and can be edited to customize values
|
||||
* its values override those defined in `index.php`
|
||||
|
||||
## File and directory permissions
|
||||
The server process running Shaarli must have:
|
||||
- `read` access to the following resources:
|
||||
- PHP scripts: `index.php`, `application/*.php`
|
||||
- 3rd party PHP and Javascript libraries: `inc/*.php`, `inc\*.js`
|
||||
- static assets:
|
||||
- CSS stylesheets: `inc\*.css`
|
||||
- `images\*`
|
||||
- RainTPL templates: `tpl\*.html`
|
||||
- `read`, `write` and `execution` access to the following directories:
|
||||
- `cache` - thumbnail cache
|
||||
- `data` - link data store, configuration options
|
||||
- `pagecache` - Atom/RSS feed cache
|
||||
- `tmp` - RainTPL page cache
|
||||
|
||||
On a Linux distribution:
|
||||
- the web server user will likely be `www` or `http` (for Apache2)
|
||||
- it will be a member of a group of the same name: `www:www`, `http:http`
|
||||
- to give it access to Shaarli, either:
|
||||
- unzip Shaarli in the default web server location (usually `/var/www/`) and set the web server user as the owner
|
||||
- put users in the same group as the web server, and set the appropriate access rights
|
||||
- if you have a domain / subdomain to serve Shaarli, [configure the server](Server-configuration) accordingly[](.html)
|
||||
|
||||
## Example `data/config.php`
|
||||
```php
|
||||
<?php
|
||||
// User login
|
||||
$GLOBALS['login'] = '<login>';[](.html)
|
||||
|
||||
// User password hash
|
||||
$GLOBALS['hash'] = '200c452da46c2f889e5e48c49ef044bcacdcb095';[](.html)
|
||||
|
||||
// Password salt
|
||||
$GLOBALS['salt'] = '13b654102321576033d8473b63a275a1bf94c0f0'; [](.html)
|
||||
|
||||
// Local timezone
|
||||
$GLOBALS['timezone'] = 'Africa/Abidjan';[](.html)
|
||||
date_default_timezone_set('Africa/Abidjan');
|
||||
|
||||
// Shaarli title
|
||||
$GLOBALS['title'] = 'My Little Shaarly';[](.html)
|
||||
|
||||
// Link the Shaarli title points to
|
||||
$GLOBALS['titleLink'] = '?';[](.html)
|
||||
|
||||
// HTTP referer redirector
|
||||
$GLOBALS['redirector'] = '';[](.html)
|
||||
|
||||
// Disable session hijacking
|
||||
$GLOBALS['disablesessionprotection'] = false; [](.html)
|
||||
|
||||
// Whether new links are private by default
|
||||
$GLOBALS['privateLinkByDefault'] = false;[](.html)
|
||||
|
||||
// Subdirectory where Shaarli stores its data files.
|
||||
// You can change it for better security.
|
||||
$GLOBALS['config'['DATADIR'] = 'data';]('DATADIR']-=-'data';.html)
|
||||
|
||||
// File used to store settings
|
||||
$GLOBALS['config'['CONFIG_FILE'] = 'data/config.php';]('CONFIG_FILE']-=-'data/config.php';.html)
|
||||
|
||||
// File containing the link database
|
||||
$GLOBALS['config'['DATASTORE'] = 'data/datastore.php';]('DATASTORE']-=-'data/datastore.php';.html)
|
||||
|
||||
// Number of links displayed per page
|
||||
$GLOBALS['config'['LINKS_PER_PAGE'] = 20;]('LINKS_PER_PAGE']-=-20;.html)
|
||||
|
||||
// File recording failed login attempts and IP bans
|
||||
$GLOBALS['config'['IPBANS_FILENAME'] = 'data/ipbans.php';]('IPBANS_FILENAME']-=-'data/ipbans.php';.html)
|
||||
|
||||
// Failed login attempts before being banned
|
||||
$GLOBALS['config'['BAN_AFTER'] = 4;]('BAN_AFTER']-=-4;.html)
|
||||
|
||||
// Duration of an IP ban, in seconds (30 minutes)
|
||||
$GLOBALS['config'['BAN_DURATION'] = 1800;]('BAN_DURATION']-=-1800;.html)
|
||||
|
||||
// If set to true, everyone will be able to add, edit and remove links,
|
||||
// as well as change configuration
|
||||
$GLOBALS['config'['OPEN_SHAARLI'] = false;]('OPEN_SHAARLI']-=-false;.html)
|
||||
|
||||
// Do not show link timestamps
|
||||
$GLOBALS['config'['HIDE_TIMESTAMPS'] = false;]('HIDE_TIMESTAMPS']-=-false;.html)
|
||||
|
||||
// Set to false to disable local thumbnail cache, e.g. due to limited disk quotas
|
||||
$GLOBALS['config'['ENABLE_THUMBNAILS'] = true;]('ENABLE_THUMBNAILS']-=-true;.html)
|
||||
|
||||
// Thumbnail cache directory
|
||||
$GLOBALS['config'['CACHEDIR'] = 'cache';]('CACHEDIR']-=-'cache';.html)
|
||||
|
||||
// Enable feed (rss, atom, dailyrss) cache
|
||||
$GLOBALS['config'['ENABLE_LOCALCACHE'] = true;]('ENABLE_LOCALCACHE']-=-true;.html)
|
||||
|
||||
// Feed cache directory
|
||||
$GLOBALS['config'['PAGECACHE'] = 'pagecache';]('PAGECACHE']-=-'pagecache';.html)
|
||||
|
||||
// RainTPL cache directory (keep the trailing slash!)
|
||||
$GLOBALS['config'['RAINTPL_TMP'] = 'tmp/';]('RAINTPL_TMP']-=-'tmp/';.html)
|
||||
|
||||
// RainTPL template directory (keep the trailing slash!)
|
||||
$GLOBALS['config'['RAINTPL_TPL'] = 'tpl/';]('RAINTPL_TPL']-=-'tpl/';.html)
|
||||
|
||||
// Whether Shaarli checks for new releases at https://github.com/shaarli/Shaarli
|
||||
$GLOBALS['config'['ENABLE_UPDATECHECK'] = true;]('ENABLE_UPDATECHECK']-=-true;.html)
|
||||
|
||||
// File to store the latest Shaarli version
|
||||
$GLOBALS['config'['UPDATECHECK_FILENAME'] = 'data/lastupdatecheck.txt';]('UPDATECHECK_FILENAME']-=-'data/lastupdatecheck.txt';.html)
|
||||
|
||||
// Delay between version checks (requires to be logged in) (24 hours)
|
||||
$GLOBALS['config'['UPDATECHECK_INTERVAL'] = 86400;]('UPDATECHECK_INTERVAL']-=-86400;.html)
|
||||
|
||||
// For each link, display a link to an archived version on archive.org
|
||||
$GLOBALS['config'['ARCHIVE_ORG'] = false;]('ARCHIVE_ORG']-=-false;.html)
|
||||
|
||||
// The RSS item links point:
|
||||
// true => directly to the link
|
||||
// false => to the entry on Shaarli (permalink)
|
||||
$GLOBALS['config'['ENABLE_RSS_PERMALINKS'] = true;]('ENABLE_RSS_PERMALINKS']-=-true;.html)
|
||||
|
||||
// Hide all links to non-logged users
|
||||
$GLOBALS['config'['HIDE_PUBLIC_LINKS'] = false;]('HIDE_PUBLIC_LINKS']-=-false;.html)
|
||||
|
||||
$GLOBALS['config'['PUBSUBHUB_URL'] = '';]('PUBSUBHUB_URL']-=-'';.html)
|
||||
|
||||
// Show an ATOM Feed button next to the Subscribe (RSS) button.
|
||||
// ATOM feeds are available at the address ?do=atom regardless of this option.
|
||||
$GLOBALS['config'['SHOW_ATOM'] = false;]('SHOW_ATOM']-=-false;.html)
|
||||
?>
|
||||
```
|
76
doc/Sharing-button.html
Normal file
76
doc/Sharing-button.html
Normal file
|
@ -0,0 +1,76 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>Shaarli - Sharing button</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="sharing-button">Sharing button</h1>
|
||||
<h3 id="add-the-sharing-button-bookmarklet-to-your-browser">Add the sharing button (<em>bookmarklet</em>) to your browser</h3>
|
||||
<ul>
|
||||
<li>Open your Shaarli and <code>Login</code></li>
|
||||
<li>Click the <code>Tools</code> button in the top bar</li>
|
||||
<li>Drag the <strong><code>✚Shaare link</code> button</strong>, and drop it to your browser's bookmarks bar.</li>
|
||||
</ul>
|
||||
<p><em>This bookmarklet button is compatible with Firefox, Opera, Chrome and Safari. Under Opera, you can't drag'n drop the button: You have to right-click on it and add a bookmark to your personal toolbar.</em></p>
|
||||
<p><embed src="(images/bookmarklet.png).html" /></p>
|
||||
<h3 id="share-links-using-the-bookmarklet">Share links using the <em>bookmarklet</em></h3>
|
||||
<ul>
|
||||
<li>When you are visiting a webpage you would like to share with Shaarli, click the <em>bookmarklet</em> you just added.</li>
|
||||
<li>A window opens.</li>
|
||||
<li>You can freely edit title, description, tags... to find it later using the text search or tag filtering.</li>
|
||||
<li>You will be able to edit this link later using the <embed src="(https://raw.githubusercontent.com/shaarli/Shaarli/master/images/edit_icon.png)-edit-button..html" /></li>
|
||||
<li>You can also check the “Private” box so that the link is saved but only visible to you.</li>
|
||||
<li>Click <code>Save</code>.<strong>Voilà! Your link is now shared.</strong></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
19
doc/Sharing-button.md
Normal file
19
doc/Sharing-button.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
#Sharing button
|
||||
### Add the sharing button (_bookmarklet_) to your browser
|
||||
|
||||
* Open your Shaarli and `Login`
|
||||
* Click the `Tools` button in the top bar
|
||||
* Drag the **`✚Shaare link` button**, and drop it to your browser's bookmarks bar.
|
||||
|
||||
_This bookmarklet button is compatible with Firefox, Opera, Chrome and Safari. Under Opera, you can't drag'n drop the button: You have to right-click on it and add a bookmark to your personal toolbar._
|
||||
|
||||
![(images/bookmarklet.png)]((images/bookmarklet.png).html)
|
||||
|
||||
### Share links using the _bookmarklet_
|
||||
|
||||
* When you are visiting a webpage you would like to share with Shaarli, click the _bookmarklet_ you just added.
|
||||
* A window opens.
|
||||
* You can freely edit title, description, tags... to find it later using the text search or tag filtering.
|
||||
* You will be able to edit this link later using the ![(https://raw.githubusercontent.com/shaarli/Shaarli/master/images/edit_icon.png) edit button.]((https://raw.githubusercontent.com/shaarli/Shaarli/master/images/edit_icon.png)-edit-button..html)
|
||||
* You can also check the “Private” box so that the link is saved but only visible to you.
|
||||
* Click `Save`.**Voilà! Your link is now shared.**
|
72
doc/Static-analysis.html
Normal file
72
doc/Static-analysis.html
Normal file
|
@ -0,0 +1,72 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>Shaarli - Static analysis</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="static-analysis">Static analysis</h1>
|
||||
<h2 id="wip">WIP</h2>
|
||||
<p>This topic is currently being discussed here:</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/shaarli/Shaarli/issues/95">Fix coding style (static analysis)</a> (#95)<a href=".html"></a></li>
|
||||
<li><a href="https://github.com/shaarli/Shaarli/issues/130">Continuous Integration tools & features</a> (#130)<a href=".html"></a></li>
|
||||
</ul>
|
||||
<h3 id="usage">Usage</h3>
|
||||
<p>Static analysis tools can be installed with Composer, and used through Shaarli's <a href="https://github.com/shaarli/Shaarli/blob/master/Makefile">Makefile</a>.<a href=".html"></a></p>
|
||||
<p>For an overview of the available features, see:</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/shaarli/Shaarli/pull/124">Code quality: Makefile to run static code checkers</a> (#124)<a href=".html"></a></li>
|
||||
<li><a href="https://github.com/shaarli/Shaarli/pull/276">Run PHPCS against different coding standards</a> (#276)<a href=".html"></a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
12
doc/Static-analysis.md
Normal file
12
doc/Static-analysis.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
#Static analysis
|
||||
## WIP
|
||||
This topic is currently being discussed here:
|
||||
- [Fix coding style (static analysis)](https://github.com/shaarli/Shaarli/issues/95) (#95)[](.html)
|
||||
- [Continuous Integration tools & features](https://github.com/shaarli/Shaarli/issues/130) (#130)[](.html)
|
||||
|
||||
### Usage
|
||||
Static analysis tools can be installed with Composer, and used through Shaarli's [Makefile](https://github.com/shaarli/Shaarli/blob/master/Makefile).[](.html)
|
||||
|
||||
For an overview of the available features, see:
|
||||
- [Code quality: Makefile to run static code checkers](https://github.com/shaarli/Shaarli/pull/124) (#124)[](.html)
|
||||
- [Run PHPCS against different coding standards](https://github.com/shaarli/Shaarli/pull/276) (#276)[](.html)
|
64
doc/TODO.html
Normal file
64
doc/TODO.html
Normal file
|
@ -0,0 +1,64 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>Shaarli - TODO</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="todo">TODO</h1>
|
||||
<ul>
|
||||
<li>add more screenshots</li>
|
||||
<li>improve developer documentation: storage architecture, classes and functions, security handling...</li>
|
||||
<li>add server configuration examples: lighthttpd</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
4
doc/TODO.md
Normal file
4
doc/TODO.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
#TODO
|
||||
* add more screenshots
|
||||
* improve developer documentation: storage architecture, classes and functions, security handling...
|
||||
* add server configuration examples: lighthttpd
|
138
doc/Theming.html
Normal file
138
doc/Theming.html
Normal file
|
@ -0,0 +1,138 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>Shaarli - Theming</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<style type="text/css">
|
||||
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
|
||||
margin: 0; padding: 0; vertical-align: baseline; border: none; }
|
||||
table.sourceCode { width: 100%; line-height: 100%; }
|
||||
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
|
||||
td.sourceCode { padding-left: 5px; }
|
||||
code > span.kw { color: #007020; font-weight: bold; }
|
||||
code > span.dt { color: #902000; }
|
||||
code > span.dv { color: #40a070; }
|
||||
code > span.bn { color: #40a070; }
|
||||
code > span.fl { color: #40a070; }
|
||||
code > span.ch { color: #4070a0; }
|
||||
code > span.st { color: #4070a0; }
|
||||
code > span.co { color: #60a0b0; font-style: italic; }
|
||||
code > span.ot { color: #007020; }
|
||||
code > span.al { color: #ff0000; font-weight: bold; }
|
||||
code > span.fu { color: #06287e; }
|
||||
code > span.er { color: #ff0000; font-weight: bold; }
|
||||
</style>
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="theming">Theming</h1>
|
||||
<h2 id="user-css">User CSS</h2>
|
||||
<ul>
|
||||
<li>Shaarli's apparence can be modified by editing CSS rules in <code>inc/user.css</code>. This file allows to override rules defined in the main <code>inc/shaarli.css</code> (only add changed rules), or define a whole new theme.</li>
|
||||
<li>Do not edit <code>inc/shaarli.css</code>! Your changes would be overriden when updating Shaarli.</li>
|
||||
<li>Some themes are available at <a href="https://github.com/shaarli/shaarli-themes" class="uri">https://github.com/shaarli/shaarli-themes</a>.</li>
|
||||
</ul>
|
||||
<p>See also:</p>
|
||||
<ul>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul>
|
||||
<h2 id="raintpl-template">RainTPL template</h2>
|
||||
<p><em>WARNING - This feature is currently being worked on and will be improved in the next releases. Experimental.</em></p>
|
||||
<ul>
|
||||
<li>Find the template you'd like to install (see the list of <a href="available-templates|Theming#community-themes--templates.html">available templates|Theming#community-themes--templates</a>)</li>
|
||||
<li>Find it's git clone URL or download the zip archive for the template.</li>
|
||||
<li>In your Shaarli <code>tpl/</code> directory, run <code>git clone https://url/of/my-template/</code> or unpack the zip archive.
|
||||
<ul>
|
||||
<li>There should now be a <code>my-template/</code> directory under the <code>tpl/</code> dir, containing directly all the template files.</li>
|
||||
</ul></li>
|
||||
<li><p>Edit <code>data/config.php</code> to have Shaarli use this template, e.g.</p>
|
||||
<pre class="sourceCode php"><code class="sourceCode php"><span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'RAINTPL_TPL'</span><span class="ot">]</span> = <span class="st">'tpl/my-template/'</span><span class="ot">;](</span><span class="st">'RAINTPL_TPL'</span><span class="ot">]</span>-=-<span class="st">'tpl/my-template/'</span><span class="ot">;</span>.html<span class="ot">)</span></code></pre></li>
|
||||
</ul>
|
||||
<h2 id="community-themes-templates">Community themes & templates</h2>
|
||||
<ul>
|
||||
<li><a href="https://github.com/AkibaTech/Shaarli---SuperHero-Theme">AkibaTech/Shaarli Superhero Theme</a> - A template/theme for Shaarli<a href=".html"></a></li>
|
||||
<li><a href="https://github.com/alexisju/albinomouse-template">alexisju/albinomouse-template</a> - A full template for Shaarli<a href=".html"></a></li>
|
||||
<li><a href="https://github.com/dhoko/ShaarliTemplate">dhoko/ShaarliTemplate</a> - A template/theme for Shaarli<a href=".html"></a></li>
|
||||
<li><a href="https://github.com/kalvn/shaarli-blocks">kalvn/shaarli-blocks</a> - A template/theme for Shaarli<a href=".html"></a></li>
|
||||
<li><a href="https://github.com/kalvn/Shaarli-Material">kalvn/Shaarli-Material</a> - A theme (template) based on Google's Material Design for Shaarli, the superfast delicious clone.<a href=".html"></a></li>
|
||||
<li><a href="https://github.com/misterair/limonade">misterair/Limonade</a> - A fork of (legacy) Shaarli with a new template<a href=".html"></a></li>
|
||||
<li><a href="https://github.com/Vinm/Blue-theme-for-Shaarli">Vinm/Blue-theme-for Shaarli</a> - A template/theme for Shaarli (<a href="https://github.com/Vinm/Blue-theme-for-Shaarli/issues/2">unmaintained</a>, compatibility unknown)<a href=".html"></a></li>
|
||||
<li><a href="https://github.com/vivienhaese/shaarlitheme">vivienhaese/shaarlitheme</a> - A Shaarli fork meant to be run in an openshift instance<a href=".html"></a></li>
|
||||
</ul>
|
||||
<h3 id="example-installation-albinomouse-template">Example installation: AlbinoMouse template</h3>
|
||||
<p>With the following configuration:</p>
|
||||
<ul>
|
||||
<li>Apache 2 / PHP 5.6</li>
|
||||
<li>user sites are enabled, e.g. <code>/home/user/public_html/somedir</code> is served as <code>http://localhost/~user/somedir</code></li>
|
||||
<li><code>http</code> is the name of the Apache user</li>
|
||||
</ul>
|
||||
<pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="kw">cd</span> ~/public_html
|
||||
|
||||
<span class="co"># clone repositories</span>
|
||||
$ <span class="kw">git</span> clone https://github.com/shaarli/Shaarli.git shaarli
|
||||
$ <span class="kw">pushd</span> shaarli/tpl
|
||||
$ <span class="kw">git</span> clone https://github.com/alexisju/albinomouse-template.git
|
||||
$ <span class="kw">popd</span>
|
||||
|
||||
<span class="co"># set access rights for Apache</span>
|
||||
$ <span class="kw">chgrp</span> -R http shaarli
|
||||
$ <span class="kw">chmod</span> g+rwx shaarli shaarli/cache shaarli/data shaarli/pagecache shaarli/tmp</code></pre>
|
||||
<p>Get config written:</p>
|
||||
<ul>
|
||||
<li>go to the freshly installed site</li>
|
||||
<li>fill the install form</li>
|
||||
<li>log in to Shaarli</li>
|
||||
</ul>
|
||||
<p>Edit Shaarli's <a href="configuration|Shaarli-configuration.html">configuration|Shaarli configuration</a>:</p>
|
||||
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="co"># the file should be owned by Apache, thus not writeable => sudo</span>
|
||||
$ <span class="kw">sudo</span> sed -i s=tpl=tpl/albinomouse-template=g shaarli/data/config.php</code></pre>
|
||||
</body>
|
||||
</html>
|
63
doc/Theming.md
Normal file
63
doc/Theming.md
Normal file
|
@ -0,0 +1,63 @@
|
|||
#Theming
|
||||
## User CSS
|
||||
|
||||
- Shaarli's apparence can be modified by editing CSS rules in `inc/user.css`. This file allows to override rules defined in the main `inc/shaarli.css` (only add changed rules), or define a whole new theme.
|
||||
- Do not edit `inc/shaarli.css`! Your changes would be overriden when updating Shaarli.
|
||||
- Some themes are available at https://github.com/shaarli/shaarli-themes.
|
||||
|
||||
See also:
|
||||
- [Download CSS styles from an OPML list](Download-CSS-styles-from-an-OPML-list.html)
|
||||
|
||||
## RainTPL template
|
||||
|
||||
_WARNING - This feature is currently being worked on and will be improved in the next releases. Experimental._
|
||||
|
||||
- Find the template you'd like to install (see the list of [available templates|Theming#community-themes--templates](available-templates|Theming#community-themes--templates.html))
|
||||
- Find it's git clone URL or download the zip archive for the template.
|
||||
- In your Shaarli `tpl/` directory, run `git clone https://url/of/my-template/` or unpack the zip archive.
|
||||
- There should now be a `my-template/` directory under the `tpl/` dir, containing directly all the template files.
|
||||
- Edit `data/config.php` to have Shaarli use this template, e.g.
|
||||
```php
|
||||
$GLOBALS['config'['RAINTPL_TPL'] = 'tpl/my-template/';]('RAINTPL_TPL']-=-'tpl/my-template/';.html)
|
||||
```
|
||||
|
||||
## Community themes & templates
|
||||
- [AkibaTech/Shaarli Superhero Theme](https://github.com/AkibaTech/Shaarli---SuperHero-Theme) - A template/theme for Shaarli[](.html)
|
||||
- [alexisju/albinomouse-template](https://github.com/alexisju/albinomouse-template) - A full template for Shaarli[](.html)
|
||||
- [dhoko/ShaarliTemplate](https://github.com/dhoko/ShaarliTemplate) - A template/theme for Shaarli[](.html)
|
||||
- [kalvn/shaarli-blocks](https://github.com/kalvn/shaarli-blocks) - A template/theme for Shaarli[](.html)
|
||||
- [kalvn/Shaarli-Material](https://github.com/kalvn/Shaarli-Material) - A theme (template) based on Google's Material Design for Shaarli, the superfast delicious clone.[](.html)
|
||||
- [misterair/Limonade](https://github.com/misterair/limonade) - A fork of (legacy) Shaarli with a new template[](.html)
|
||||
- [Vinm/Blue-theme-for Shaarli](https://github.com/Vinm/Blue-theme-for-Shaarli) - A template/theme for Shaarli ([unmaintained](https://github.com/Vinm/Blue-theme-for-Shaarli/issues/2), compatibility unknown)[](.html)
|
||||
- [vivienhaese/shaarlitheme](https://github.com/vivienhaese/shaarlitheme) - A Shaarli fork meant to be run in an openshift instance[](.html)
|
||||
|
||||
### Example installation: AlbinoMouse template
|
||||
With the following configuration:
|
||||
- Apache 2 / PHP 5.6
|
||||
- user sites are enabled, e.g. `/home/user/public_html/somedir` is served as `http://localhost/~user/somedir`
|
||||
- `http` is the name of the Apache user
|
||||
|
||||
```bash
|
||||
$ cd ~/public_html
|
||||
|
||||
# clone repositories
|
||||
$ git clone https://github.com/shaarli/Shaarli.git shaarli
|
||||
$ pushd shaarli/tpl
|
||||
$ git clone https://github.com/alexisju/albinomouse-template.git
|
||||
$ popd
|
||||
|
||||
# set access rights for Apache
|
||||
$ chgrp -R http shaarli
|
||||
$ chmod g+rwx shaarli shaarli/cache shaarli/data shaarli/pagecache shaarli/tmp
|
||||
```
|
||||
|
||||
Get config written:
|
||||
- go to the freshly installed site
|
||||
- fill the install form
|
||||
- log in to Shaarli
|
||||
|
||||
Edit Shaarli's [configuration|Shaarli configuration](configuration|Shaarli-configuration.html):
|
||||
```bash
|
||||
# the file should be owned by Apache, thus not writeable => sudo
|
||||
$ sudo sed -i s=tpl=tpl/albinomouse-template=g shaarli/data/config.php
|
||||
```
|
122
doc/Troubleshooting.html
Normal file
122
doc/Troubleshooting.html
Normal file
|
@ -0,0 +1,122 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>Shaarli - Troubleshooting</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<style type="text/css">
|
||||
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
|
||||
margin: 0; padding: 0; vertical-align: baseline; border: none; }
|
||||
table.sourceCode { width: 100%; line-height: 100%; }
|
||||
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
|
||||
td.sourceCode { padding-left: 5px; }
|
||||
code > span.kw { color: #007020; font-weight: bold; }
|
||||
code > span.dt { color: #902000; }
|
||||
code > span.dv { color: #40a070; }
|
||||
code > span.bn { color: #40a070; }
|
||||
code > span.fl { color: #40a070; }
|
||||
code > span.ch { color: #4070a0; }
|
||||
code > span.st { color: #4070a0; }
|
||||
code > span.co { color: #60a0b0; font-style: italic; }
|
||||
code > span.ot { color: #007020; }
|
||||
code > span.al { color: #ff0000; font-weight: bold; }
|
||||
code > span.fu { color: #06287e; }
|
||||
code > span.er { color: #ff0000; font-weight: bold; }
|
||||
</style>
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="troubleshooting">Troubleshooting</h1>
|
||||
<h2 id="login">Login</h2>
|
||||
<h3 id="i-forgot-my-password">I forgot my password!</h3>
|
||||
<p>Delete the file <code>data/config.php</code> and display the page again. You will be asked for a new login/password.</p>
|
||||
<h3 id="im-locked-out---login-bruteforce-protection">I'm locked out - Login bruteforce protection</h3>
|
||||
<p>Login form is protected against brute force attacks: 4 failed logins will ban the IP address from login for 30 minutes. Banned IPs can still browse links.</p>
|
||||
<p>To remove the current IP bans, delete the file <code>data/ipbans.php</code></p>
|
||||
<h3 id="list-of-all-login-attempts">List of all login attempts</h3>
|
||||
<p>The file <code>data/log.txt</code> shows all logins (successful or failed) and bans/lifted bans.<br />Search for <code>failed</code> in this file to look for unauthorized login attempts.</p>
|
||||
<h2 id="hosting-problems">Hosting problems</h2>
|
||||
<ul>
|
||||
<li>On <strong>free.fr</strong> : Please note that free uses php 5.1 and thus you will not have autocomplete in tag editing. Don't forget to create a <code>sessions</code> directory at the root of your webspace. Change the file extension to <code>.php5</code> or create a <code>.htaccess</code> file in the directory where Shaarli is located containing:</li>
|
||||
</ul>
|
||||
<pre class="sourceCode ini"><code class="sourceCode ini"><span class="dt">php 1</span>
|
||||
<span class="dt">SetEnv PHP_VER 5</span></code></pre>
|
||||
<ul>
|
||||
<li>If you have an error such as: <code>Parse error: syntax error, unexpected '=', expecting '(' in /links/index.php on line xxx</code>, it means that your host is using php4, not php5. Shaarli requires php 5.1. Try changing the file extension to <code>.php5</code></li>
|
||||
<li>On <strong>1and1</strong> : If you add the link from the page (and not from the bookmarklet), Shaarli will no be able to get the title of the page. You will have to enter it manually. (Because they have disabled the ability to download a file through HTTP).</li>
|
||||
<li>If you have the error <code>Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /…/index.php on line xxx</code>, it means that your host has disabled the ability to fetch a file by HTTP in the php config (Typically in 1and1 hosting). Bad host. Change host. Or comment the following lines:<a href=".html"></a></li>
|
||||
</ul>
|
||||
<pre class="sourceCode php"><code class="sourceCode php"><span class="co">//list($status,$headers,$data) = getHTTP($url,4); // Short timeout to keep the application responsive.</span>
|
||||
<span class="co">// FIXME: Decode charset according to charset specified in either 1) HTTP response headers or 2) <head> in html </span>
|
||||
<span class="co">//if (strpos($status,'200 OK')) $title=html_extract_title($data);</span></code></pre>
|
||||
<ul>
|
||||
<li>On hosts which forbid outgoing HTTP requests (such as free.fr), some thumbnails will not work.</li>
|
||||
<li>On <strong>lost-oasis</strong>, RSS doesn't work correctly, because of this message at the begining of the RSS/ATOM feed : <code><? // tout ce qui est charge ici (generalement des includes et require) est charge en permanence. ?></code>. To fix this, remove this message from <code>php-include/prepend.php</code></li>
|
||||
</ul>
|
||||
<h3 id="dates-are-not-properly-formatted">Dates are not properly formatted</h3>
|
||||
<p>Shaarli tries to sniff the language of the browser (using HTTP_ACCEPT_LANGUAGE headers) and choose a date format accordingly. But Shaarli can only use the date formats (and more generaly speaking, the locales) provided by the webserver. So even if you have a browser in French, you may end up with dates in US format (it's the case on sebsauvage.net :-( )</p>
|
||||
<h3 id="problems-on-centos-servers">Problems on CentOS servers</h3>
|
||||
<p>On <strong>CentOS</strong>/RedHat derivatives, you may need to install the <code>php-mbstring</code> package.</p>
|
||||
<h3 id="my-session-expires-i-cant-stay-logged-in">My session expires! I can't stay logged in</h3>
|
||||
<p>This can be caused by several things:</p>
|
||||
<ul>
|
||||
<li>Your php installation may not have a proper directory setup for session files. (eg. on Free.fr you need to create a <code>session</code> directory on the root of your website.) You may need to create the session directory of set it up.</li>
|
||||
<li>Most hosts regularly clean the temporary and session directories. Your host may be cleaning those directories too aggressively (eg.OVH hosts), forcing an expire of the session. You may want to set the session directory in your web root. (eg. Create the <code>sessions</code> subdirectory and add <code>ini_set('session.save_path', $_SERVER['DOCUMENT_ROOT'].'/../sessions');</code>. Make sure this directory is not browsable !)<a href=".html"></a></li>
|
||||
<li>If your IP address changes during surfing, Shaarli will force expire your session for security reasons (to prevent session cookie hijacking). This can happen when surfing from WiFi or 3G (you may have switched WiFi/3G access point), or in some corporate/university proxies which use load balancing (and may have proxies with several external IP addresses).</li>
|
||||
<li>Some browser addons may interfer with HTTP headers (ipfuck/ipflood/GreaseMonkey…). Try disabling those.</li>
|
||||
<li>You may be using OperaTurbo or OperaMini, which use their own proxies which may change from time to time.</li>
|
||||
<li>If you have another application on the same webserver where Shaarli is installed, these application may forcefully expire php sessions.</li>
|
||||
</ul>
|
||||
<h2 id="sessions-do-not-seem-to-work-correctly-on-your-server">Sessions do not seem to work correctly on your server</h2>
|
||||
<p>Follow the instructions in the error message. Make sure you are accessing shaarli via a direct IP address or a proper hostname. If you have <strong>no dots</strong> in the hostname (e.g. <code>localhost</code> or <code>http://my-webserver/shaarli/</code>), some browsers will not store cookies at all (this respects the <a href="http://curl.haxx.se/rfc/cookie_spec.html">HTTP cookie specification</a>).<a href=".html"></a></p>
|
||||
<h3 id="pubsubhubbub-support">pubsubhubbub support</h3>
|
||||
<p>Download <a href="https://pubsubhubbub.googlecode.com/git/publisher_clients/php/library/publisher.php">publisher.php</a> at the root of your Shaarli installation and set <code>$GLOBALS['config'['PUBSUBHUB_URL']</code> in your <code>config.php</code>]('PUBSUBHUB_URL']<code>-in-your-</code>config.php`.html)</p>
|
||||
</body>
|
||||
</html>
|
60
doc/Troubleshooting.md
Normal file
60
doc/Troubleshooting.md
Normal file
|
@ -0,0 +1,60 @@
|
|||
#Troubleshooting
|
||||
## Login
|
||||
### I forgot my password!
|
||||
|
||||
Delete the file `data/config.php` and display the page again. You will be asked for a new login/password.
|
||||
|
||||
### I'm locked out - Login bruteforce protection
|
||||
Login form is protected against brute force attacks: 4 failed logins will ban the IP address from login for 30 minutes. Banned IPs can still browse links.
|
||||
|
||||
To remove the current IP bans, delete the file `data/ipbans.php`
|
||||
|
||||
### List of all login attempts
|
||||
|
||||
The file `data/log.txt` shows all logins (successful or failed) and bans/lifted bans.
|
||||
Search for `failed` in this file to look for unauthorized login attempts.
|
||||
|
||||
## Hosting problems
|
||||
* On **free.fr** : Please note that free uses php 5.1 and thus you will not have autocomplete in tag editing. Don't forget to create a `sessions` directory at the root of your webspace. Change the file extension to `.php5` or create a `.htaccess` file in the directory where Shaarli is located containing:
|
||||
|
||||
```ini
|
||||
php 1
|
||||
SetEnv PHP_VER 5
|
||||
```
|
||||
|
||||
* If you have an error such as: `Parse error: syntax error, unexpected '=', expecting '(' in /links/index.php on line xxx`, it means that your host is using php4, not php5. Shaarli requires php 5.1. Try changing the file extension to `.php5`
|
||||
* On **1and1** : If you add the link from the page (and not from the bookmarklet), Shaarli will no be able to get the title of the page. You will have to enter it manually. (Because they have disabled the ability to download a file through HTTP).
|
||||
* If you have the error `Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /…/index.php on line xxx`, it means that your host has disabled the ability to fetch a file by HTTP in the php config (Typically in 1and1 hosting). Bad host. Change host. Or comment the following lines:[](.html)
|
||||
|
||||
```php
|
||||
//list($status,$headers,$data) = getHTTP($url,4); // Short timeout to keep the application responsive.
|
||||
// FIXME: Decode charset according to charset specified in either 1) HTTP response headers or 2) <head> in html
|
||||
//if (strpos($status,'200 OK')) $title=html_extract_title($data);
|
||||
```
|
||||
|
||||
* On hosts which forbid outgoing HTTP requests (such as free.fr), some thumbnails will not work.
|
||||
* On **lost-oasis**, RSS doesn't work correctly, because of this message at the begining of the RSS/ATOM feed : `<? // tout ce qui est charge ici (generalement des includes et require) est charge en permanence. ?>`. To fix this, remove this message from `php-include/prepend.php`
|
||||
|
||||
### Dates are not properly formatted
|
||||
Shaarli tries to sniff the language of the browser (using HTTP_ACCEPT_LANGUAGE headers) and choose a date format accordingly. But Shaarli can only use the date formats (and more generaly speaking, the locales) provided by the webserver. So even if you have a browser in French, you may end up with dates in US format (it's the case on sebsauvage.net :-( )
|
||||
|
||||
### Problems on CentOS servers
|
||||
On **CentOS**/RedHat derivatives, you may need to install the `php-mbstring` package.
|
||||
|
||||
|
||||
### My session expires! I can't stay logged in
|
||||
This can be caused by several things:
|
||||
|
||||
* Your php installation may not have a proper directory setup for session files. (eg. on Free.fr you need to create a `session` directory on the root of your website.) You may need to create the session directory of set it up.
|
||||
* Most hosts regularly clean the temporary and session directories. Your host may be cleaning those directories too aggressively (eg.OVH hosts), forcing an expire of the session. You may want to set the session directory in your web root. (eg. Create the `sessions` subdirectory and add `ini_set('session.save_path', $_SERVER['DOCUMENT_ROOT'].'/../sessions');`. Make sure this directory is not browsable !)[](.html)
|
||||
* If your IP address changes during surfing, Shaarli will force expire your session for security reasons (to prevent session cookie hijacking). This can happen when surfing from WiFi or 3G (you may have switched WiFi/3G access point), or in some corporate/university proxies which use load balancing (and may have proxies with several external IP addresses).
|
||||
* Some browser addons may interfer with HTTP headers (ipfuck/ipflood/GreaseMonkey…). Try disabling those.
|
||||
* You may be using OperaTurbo or OperaMini, which use their own proxies which may change from time to time.
|
||||
* If you have another application on the same webserver where Shaarli is installed, these application may forcefully expire php sessions.
|
||||
|
||||
## Sessions do not seem to work correctly on your server
|
||||
Follow the instructions in the error message. Make sure you are accessing shaarli via a direct IP address or a proper hostname. If you have **no dots** in the hostname (e.g. `localhost` or `http://my-webserver/shaarli/`), some browsers will not store cookies at all (this respects the [HTTP cookie specification](http://curl.haxx.se/rfc/cookie_spec.html)).[](.html)
|
||||
|
||||
### pubsubhubbub support
|
||||
|
||||
Download [publisher.php](https://pubsubhubbub.googlecode.com/git/publisher_clients/php/library/publisher.php) at the root of your Shaarli installation and set `$GLOBALS['config'['PUBSUBHUB_URL']` in your `config.php`]('PUBSUBHUB_URL']`-in-your-`config.php`.html)
|
|
@ -4,7 +4,7 @@
|
|||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title></title>
|
||||
<title>Shaarli - Unit tests</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
|
@ -31,12 +31,55 @@ code > span.er { color: #ff0000; font-weight: bold; }
|
|||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="unit-tests">Unit tests</h1>
|
||||
<h3 id="setup-your-environment-for-tests">Setup your environment for tests</h3>
|
||||
<p>The framework used is <a href="https://phpunit.de/">PHPUnit</a>; it can be installed with <a href="https://getcomposer.org/">Composer</a>, which is a dependency management tool.</p>
|
||||
<p>The framework used is <a href="https://phpunit.de/">PHPUnit</a>; it can be installed with <a href="https://getcomposer.org/">Composer</a>, which is a dependency management tool.<a href=".html"></a></p>
|
||||
<p>Regarding Composer, you can either use:</p>
|
||||
<ul>
|
||||
<li>a system-wide version, e.g. installed through your distro's package manager<br /></li>
|
||||
<li>a local version, downloadable <a href="https://getcomposer.org/download/">here</a></li>
|
||||
<li>a system-wide version, e.g. installed through your distro's package manager</li>
|
||||
<li>a local version, downloadable <a href="https://getcomposer.org/download/">here</a><a href=".html"></a></li>
|
||||
</ul>
|
||||
<h4 id="sample-usage">Sample usage</h4>
|
||||
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="co"># system-wide version</span>
|
||||
|
@ -90,7 +133,7 @@ $ <span class="kw">composer</span> update</code></pre>
|
|||
|
||||
<span class="kw">1</span>) <span class="kw">LinkDBTest</span>::testConstructLoggedIn
|
||||
<span class="kw">Missing</span> argument 2 for LinkDB::__construct(), <span class="kw">called</span> in /home/virtualtam/public_html/shaarli/tests/Link\
|
||||
<span class="kw">DBTest.php</span> on line 79 and defined
|
||||
DBTest.php on line 79 and defined
|
||||
|
||||
<span class="kw">/home/virtualtam/public_html/shaarli/application</span>/LinkDB.php:<span class="kw">58</span>
|
||||
<span class="kw">/home/virtualtam/public_html/shaarli/tests</span>/LinkDBTest.php:<span class="kw">79</span>
|
||||
|
@ -125,18 +168,18 @@ $ <span class="kw">composer</span> update</code></pre>
|
|||
<p>By default, PHPUnit will run all suitable tests found under the <code>tests</code> directory.</p>
|
||||
<p>Each test has 3 possible outcomes:</p>
|
||||
<ul>
|
||||
<li><code>.</code> - success<br /></li>
|
||||
<li><code>F</code> - failure: the test was run but its results are invalid<br /></li>
|
||||
<li>the code does not behave as expected<br /></li>
|
||||
<li>dependencies to external elements: globals, session, cache...<br /></li>
|
||||
<li><code>E</code> - error: something went wrong and the tested code has crashed<br /></li>
|
||||
<li>typos in the code, or in the test code<br /></li>
|
||||
<li><code>.</code> - success</li>
|
||||
<li><code>F</code> - failure: the test was run but its results are invalid</li>
|
||||
<li>the code does not behave as expected</li>
|
||||
<li>dependencies to external elements: globals, session, cache...</li>
|
||||
<li><code>E</code> - error: something went wrong and the tested code has crashed</li>
|
||||
<li>typos in the code, or in the test code</li>
|
||||
<li>dependencies to missing external elements</li>
|
||||
</ul>
|
||||
<p>If Xdebug has been installed and activated, two coverage reports will be generated:</p>
|
||||
<ul>
|
||||
<li>a summary in the console<br /></li>
|
||||
<li>a detailed HTML report with metrics for tested code<br /></li>
|
||||
<li>a summary in the console</li>
|
||||
<li>a detailed HTML report with metrics for tested code</li>
|
||||
<li>to open it in a web browser: <code>firefox coverage/index.html &</code></li>
|
||||
</ul>
|
||||
</body>
|
|
@ -1,10 +1,11 @@
|
|||
#Unit tests
|
||||
|
||||
### Setup your environment for tests
|
||||
The framework used is [PHPUnit](https://phpunit.de/); it can be installed with [Composer](https://getcomposer.org/), which is a dependency management tool.
|
||||
The framework used is [PHPUnit](https://phpunit.de/); it can be installed with [Composer](https://getcomposer.org/), which is a dependency management tool.[](.html)
|
||||
|
||||
Regarding Composer, you can either use:
|
||||
* a system-wide version, e.g. installed through your distro's package manager
|
||||
* a local version, downloadable [here](https://getcomposer.org/download/)
|
||||
* a local version, downloadable [here](https://getcomposer.org/download/)[](.html)
|
||||
|
||||
#### Sample usage
|
||||
```bash
|
||||
|
@ -124,4 +125,4 @@ Each test has 3 possible outcomes:
|
|||
If Xdebug has been installed and activated, two coverage reports will be generated:
|
||||
* a summary in the console
|
||||
* a detailed HTML report with metrics for tested code
|
||||
* to open it in a web browser: `firefox coverage/index.html &`
|
||||
* to open it in a web browser: `firefox coverage/index.html &`
|
85
doc/Usage.html
Normal file
85
doc/Usage.html
Normal file
|
@ -0,0 +1,85 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>Shaarli - Usage</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="usage">Usage</h1>
|
||||
<h3 id="main-features">Main features</h3>
|
||||
<p>Shaarli is intended:</p>
|
||||
<ul>
|
||||
<li>to share, comment and save interesting links and news</li>
|
||||
<li>to bookmark useful/frequent personal links (as private links) and share them between computers</li>
|
||||
<li>as a minimal blog/microblog/writing platform (no character limit)</li>
|
||||
<li>as a read-it-later list (for example items tagged <code>readlater</code>)</li>
|
||||
<li>to draft and save articles/ideas</li>
|
||||
<li>to keep code snippets</li>
|
||||
<li>to keep notes and documentation</li>
|
||||
<li>as a shared clipboard between machines</li>
|
||||
<li>as a todo list</li>
|
||||
<li>to store playlists (e.g. with the <code>music</code> or <code>video</code> tags)</li>
|
||||
<li>to keep extracts/comments from webpages that may disappear</li>
|
||||
<li>to keep track of ongoing discussions (for example items tagged <code>discussion</code>)</li>
|
||||
<li><a href="http://shaarli.chassegnouf.net/?9Efeiw">to feed RSS aggregators</a> (planets) with specific tags<a href=".html"></a></li>
|
||||
<li>to feed other social networks, blogs... using RSS feeds and external services (dlvr.it, ifttt.com ...)</li>
|
||||
</ul>
|
||||
<h3 id="using-shaarli-as-a-blog-notepad-pastebin...">Using Shaarli as a blog, notepad, pastebin...</h3>
|
||||
<ul>
|
||||
<li>Go to your Shaarli setup and log in</li>
|
||||
<li>Click the <code>Add Link</code> button</li>
|
||||
<li>To share text only, do not enter any URL in the corresponding input field and click <code>Add Link</code></li>
|
||||
<li>Pick a title and enter your article, or note, in the description field; add a few tags; optionally check <code>Private</code> then click <code>Save</code></li>
|
||||
<li>Voilà! Your article is now published (privately if you selected that option) and accessible using its permalink.</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
25
doc/Usage.md
Normal file
25
doc/Usage.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
#Usage
|
||||
### Main features
|
||||
Shaarli is intended:
|
||||
* to share, comment and save interesting links and news
|
||||
* to bookmark useful/frequent personal links (as private links) and share them between computers
|
||||
* as a minimal blog/microblog/writing platform (no character limit)
|
||||
* as a read-it-later list (for example items tagged `readlater`)
|
||||
* to draft and save articles/ideas
|
||||
* to keep code snippets
|
||||
* to keep notes and documentation
|
||||
* as a shared clipboard between machines
|
||||
* as a todo list
|
||||
* to store playlists (e.g. with the `music` or `video` tags)
|
||||
* to keep extracts/comments from webpages that may disappear
|
||||
* to keep track of ongoing discussions (for example items tagged `discussion`)
|
||||
* [to feed RSS aggregators](http://shaarli.chassegnouf.net/?9Efeiw) (planets) with specific tags[](.html)
|
||||
* to feed other social networks, blogs... using RSS feeds and external services (dlvr.it, ifttt.com ...)
|
||||
|
||||
### Using Shaarli as a blog, notepad, pastebin...
|
||||
|
||||
* Go to your Shaarli setup and log in
|
||||
* Click the `Add Link` button
|
||||
* To share text only, do not enter any URL in the corresponding input field and click `Add Link`
|
||||
* Pick a title and enter your article, or note, in the description field; add a few tags; optionally check `Private` then click `Save`
|
||||
* Voilà! Your article is now published (privately if you selected that option) and accessible using its permalink.
|
99
doc/_Sidebar.html
Normal file
99
doc/_Sidebar.html
Normal file
|
@ -0,0 +1,99 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="generator" content="pandoc">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>Shaarli - _Sidebar</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" href="github-markdown.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 id="sidebar">_Sidebar</h1>
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
29
doc/_Sidebar.md
Normal file
29
doc/_Sidebar.md
Normal file
|
@ -0,0 +1,29 @@
|
|||
#_Sidebar
|
||||
- [Home](Home.html)
|
||||
- Installation
|
||||
- [Server requirements](Server-requirements.html)
|
||||
- [Server configuration](Server-configuration.html)
|
||||
- [Shaarli configuration](Shaarli-configuration.html)
|
||||
- [Usage](Usage.html)
|
||||
- [Sharing button](Sharing-button.html) (bookmarklet)
|
||||
- [Firefox share](Firefox-share.html)
|
||||
- [RSS feeds](RSS-feeds.html)
|
||||
- How To
|
||||
- [Backup, restore, import and export](Backup,-restore,-import-and-export.html)
|
||||
- [Copy an existing installation over SSH and serve it locally](Copy-an-existing-installation-over-SSH-and-serve-it-locally.html)
|
||||
- [Download CSS styles from an OPML list](Download-CSS-styles-from-an-OPML-list.html)
|
||||
- [Troubleshooting](Troubleshooting.html)
|
||||
- [Development](Development.html)
|
||||
- [GnuPG signature](GnuPG-signature.html)
|
||||
- [Coding guidelines](Coding-guidelines.html)
|
||||
- [Directory structure](Directory-structure.html)
|
||||
- [3rd party libraries](3rd-party-libraries.html)
|
||||
- [Plugin System](Plugin-System.html)
|
||||
- [Security](Security.html)
|
||||
- [Static analysis](Static-analysis.html)
|
||||
- [Theming](Theming.html)
|
||||
- [Unit tests](Unit-tests.html)
|
||||
- About
|
||||
- [FAQ](FAQ.html)
|
||||
- [Community & Related software](Community-&-Related-software.html)
|
||||
- [TODO](TODO.html)
|
|
@ -1,3 +1,13 @@
|
|||
#local-sidebar {
|
||||
width: 230px;
|
||||
float: right;
|
||||
position: relative;
|
||||
z-index: 4;
|
||||
background-color: #fff;
|
||||
border: 1px solid #e2e2e2;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: Helvetica, arial, sans-serif;
|
||||
font-size: 14px;
|
||||
|
|
42
doc/sidebar.html
Normal file
42
doc/sidebar.html
Normal file
|
@ -0,0 +1,42 @@
|
|||
<div id="local-sidebar">
|
||||
<ul>
|
||||
<li><a href="Home.html">Home</a></li>
|
||||
<li>Installation
|
||||
<ul>
|
||||
<li><a href="Server-requirements.html">Server requirements</a></li>
|
||||
<li><a href="Server-configuration.html">Server configuration</a></li>
|
||||
<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Usage.html">Usage</a>
|
||||
<ul>
|
||||
<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
|
||||
<li><a href="Firefox-share.html">Firefox share</a></li>
|
||||
<li><a href="RSS-feeds.html">RSS feeds</a></li>
|
||||
</ul></li>
|
||||
<li>How To
|
||||
<ul>
|
||||
<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
|
||||
<li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
|
||||
<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
|
||||
</ul></li>
|
||||
<li><a href="Troubleshooting.html">Troubleshooting</a></li>
|
||||
<li><a href="Development.html">Development</a>
|
||||
<ul>
|
||||
<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
|
||||
<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
|
||||
<li><a href="Directory-structure.html">Directory structure</a></li>
|
||||
<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
|
||||
<li><a href="Plugin-System.html">Plugin System</a></li>
|
||||
<li><a href="Security.html">Security</a></li>
|
||||
<li><a href="Static-analysis.html">Static analysis</a></li>
|
||||
<li><a href="Theming.html">Theming</a></li>
|
||||
<li><a href="Unit-tests.html">Unit tests</a></li>
|
||||
</ul></li>
|
||||
<li>About
|
||||
<ul>
|
||||
<li><a href="FAQ.html">FAQ</a></li>
|
||||
<li><a href="Community-&-Related-software.html">Community & Related software</a></li>
|
||||
<li><a href="TODO.html">TODO</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
Loading…
Reference in a new issue