aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.gitattributes31
-rw-r--r--application/LinkDB.php4
-rw-r--r--docker/.htaccess2
-rw-r--r--docker/development/Dockerfile28
-rw-r--r--docker/development/IMAGE.md10
-rw-r--r--docker/development/nginx.conf64
-rw-r--r--docker/development/supervised.conf13
-rw-r--r--docker/production/Dockerfile20
-rw-r--r--docker/production/IMAGE.md5
-rw-r--r--docker/production/nginx.conf56
-rw-r--r--docker/production/stable/Dockerfile20
-rw-r--r--docker/production/stable/IMAGE.md5
-rw-r--r--docker/production/stable/nginx.conf56
-rw-r--r--docker/production/stable/supervised.conf13
-rw-r--r--docker/production/supervised.conf13
-rw-r--r--inc/shaarli.css19
-rw-r--r--index.php4
-rwxr-xr-xplugins/qrcode/qrcode.css23
-rw-r--r--plugins/qrcode/qrcode.html8
-rw-r--r--plugins/qrcode/qrcode.php22
-rw-r--r--plugins/qrcode/shaarli-qrcode.js10
-rw-r--r--shaarli_version.php2
-rw-r--r--tests/plugins/PlugQrcodeTest.php4
23 files changed, 401 insertions, 31 deletions
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 00000000..aaf6a39e
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,31 @@
1# Set default behavior
2* text=auto eol=lf
3
4# Ensure sources are processed
5*.conf text
6*.css text
7*.html text diff=html
8*.js text
9*.md text
10*.php text diff=php
11Dockerfile text
12
13# Do not alter images nor minified scripts
14*.ico binary
15*.jpg binary
16*.png binary
17*.min.css binary
18*.min.js binary
19
20# Exclude from Git archives
21.gitattributes export-ignore
22.gitignore export-ignore
23.travis.yml export-ignore
24composer.json export-ignore
25doc/**/*.json export-ignore
26doc/**/*.md export-ignore
27docker/ export-ignore
28Doxyfile export-ignore
29Makefile export-ignore
30phpunit.xml export-ignore
31tests/ export-ignore
diff --git a/application/LinkDB.php b/application/LinkDB.php
index f771ac8b..51fa926d 100644
--- a/application/LinkDB.php
+++ b/application/LinkDB.php
@@ -17,8 +17,10 @@
17 * - private: Is this link private? 0=no, other value=yes 17 * - private: Is this link private? 0=no, other value=yes
18 * - tags: tags attached to this entry (separated by spaces) 18 * - tags: tags attached to this entry (separated by spaces)
19 * - title Title of the link 19 * - title Title of the link
20 * - url URL of the link. Can be absolute or relative. 20 * - url URL of the link. Used for displayable links (no redirector, relative, etc.).
21 * Can be absolute or relative.
21 * Relative URLs are permalinks (e.g.'?m-ukcw') 22 * Relative URLs are permalinks (e.g.'?m-ukcw')
23 * - real_url Absolute processed URL.
22 * 24 *
23 * Implements 3 interfaces: 25 * Implements 3 interfaces:
24 * - ArrayAccess: behaves like an associative array; 26 * - ArrayAccess: behaves like an associative array;
diff --git a/docker/.htaccess b/docker/.htaccess
new file mode 100644
index 00000000..b584d98c
--- /dev/null
+++ b/docker/.htaccess
@@ -0,0 +1,2 @@
1Allow from none
2Deny from all
diff --git a/docker/development/Dockerfile b/docker/development/Dockerfile
new file mode 100644
index 00000000..2ed59b89
--- /dev/null
+++ b/docker/development/Dockerfile
@@ -0,0 +1,28 @@
1FROM debian:jessie
2MAINTAINER Shaarli Community
3
4RUN apt-get update \
5 && apt-get install -y \
6 nginx-light php5-fpm php5-gd supervisor \
7 git nano
8
9ADD https://getcomposer.org/composer.phar /usr/local/bin/composer
10RUN chmod 755 /usr/local/bin/composer
11
12COPY nginx.conf /etc/nginx/nginx.conf
13COPY supervised.conf /etc/supervisor/conf.d/supervised.conf
14RUN echo "<?php phpinfo(); ?>" > /var/www/index.php
15
16WORKDIR /var/www
17RUN rm -rf html \
18 && git clone https://github.com/shaarli/Shaarli.git shaarli \
19 && chown -R www-data:www-data .
20
21WORKDIR /var/www/shaarli
22RUN composer install
23
24VOLUME /var/www/shaarli/data
25
26EXPOSE 80
27
28CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"]
diff --git a/docker/development/IMAGE.md b/docker/development/IMAGE.md
new file mode 100644
index 00000000..e2ff0f0e
--- /dev/null
+++ b/docker/development/IMAGE.md
@@ -0,0 +1,10 @@
1## shaarli:dev
2- [Debian 8 Jessie](https://hub.docker.com/_/debian/)
3- [PHP5-FPM](http://php-fpm.org/)
4- [Nginx](http://nginx.org/)
5- [Shaarli](https://github.com/shaarli/Shaarli)
6
7### Development tools
8- [composer](https://getcomposer.org/)
9- [git](http://git-scm.com/)
10- [nano](http://www.nano-editor.org/)
diff --git a/docker/development/nginx.conf b/docker/development/nginx.conf
new file mode 100644
index 00000000..cda09b56
--- /dev/null
+++ b/docker/development/nginx.conf
@@ -0,0 +1,64 @@
1user www-data www-data;
2daemon off;
3worker_processes 4;
4
5events {
6 worker_connections 768;
7}
8
9http {
10 include mime.types;
11 default_type application/octet-stream;
12 keepalive_timeout 20;
13
14 index index.html index.php;
15
16 server {
17 listen 80;
18 root /var/www/shaarli;
19
20 access_log /var/log/nginx/shaarli.access.log;
21 error_log /var/log/nginx/shaarli.error.log;
22
23 location /phpinfo/ {
24 # add a PHP info page for convenience
25 fastcgi_pass unix:/var/run/php5-fpm.sock;
26 fastcgi_index index.php;
27 fastcgi_param SCRIPT_FILENAME /var/www/index.php;
28 include fastcgi_params;
29 }
30
31 location ~ /\. {
32 # deny access to dotfiles
33 access_log off;
34 log_not_found off;
35 deny all;
36 }
37
38 location ~ ~$ {
39 # deny access to temp editor files, e.g. "script.php~"
40 access_log off;
41 log_not_found off;
42 deny all;
43 }
44
45 location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
46 # cache static assets
47 expires max;
48 add_header Pragma public;
49 add_header Cache-Control "public, must-revalidate, proxy-revalidate";
50 }
51
52 location ~ (index)\.php$ {
53 # filter and proxy PHP requests to PHP-FPM
54 fastcgi_pass unix:/var/run/php5-fpm.sock;
55 fastcgi_index index.php;
56 include fastcgi.conf;
57 }
58
59 location ~ \.php$ {
60 # deny access to all other PHP scripts
61 deny all;
62 }
63 }
64}
diff --git a/docker/development/supervised.conf b/docker/development/supervised.conf
new file mode 100644
index 00000000..5acd9795
--- /dev/null
+++ b/docker/development/supervised.conf
@@ -0,0 +1,13 @@
1[program:php5-fpm]
2command=/usr/sbin/php5-fpm -F
3priority=5
4autostart=true
5autorestart=true
6
7[program:nginx]
8command=/usr/sbin/nginx
9priority=10
10autostart=true
11autorestart=true
12stdout_events_enabled=true
13stderr_events_enabled=true
diff --git a/docker/production/Dockerfile b/docker/production/Dockerfile
new file mode 100644
index 00000000..3db4eb56
--- /dev/null
+++ b/docker/production/Dockerfile
@@ -0,0 +1,20 @@
1FROM debian:jessie
2MAINTAINER Shaarli Community
3
4RUN apt-get update \
5 && apt-get install -y curl nginx-light php5-fpm php5-gd supervisor
6
7COPY nginx.conf /etc/nginx/nginx.conf
8COPY supervised.conf /etc/supervisor/conf.d/supervised.conf
9
10WORKDIR /var/www
11RUN rm -rf html \
12 && curl -L https://github.com/shaarli/Shaarli/archive/master.tar.gz | tar xvzf - \
13 && mv Shaarli-master shaarli \
14 && chown -R www-data:www-data shaarli
15
16VOLUME /var/www/shaarli/data
17
18EXPOSE 80
19
20CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"]
diff --git a/docker/production/IMAGE.md b/docker/production/IMAGE.md
new file mode 100644
index 00000000..6f827b35
--- /dev/null
+++ b/docker/production/IMAGE.md
@@ -0,0 +1,5 @@
1## shaarli:latest
2- [Debian 8 Jessie](https://hub.docker.com/_/debian/)
3- [PHP5-FPM](http://php-fpm.org/)
4- [Nginx](http://nginx.org/)
5- [Shaarli](https://github.com/shaarli/Shaarli)
diff --git a/docker/production/nginx.conf b/docker/production/nginx.conf
new file mode 100644
index 00000000..e23c4587
--- /dev/null
+++ b/docker/production/nginx.conf
@@ -0,0 +1,56 @@
1user www-data www-data;
2daemon off;
3worker_processes 4;
4
5events {
6 worker_connections 768;
7}
8
9http {
10 include mime.types;
11 default_type application/octet-stream;
12 keepalive_timeout 20;
13
14 index index.html index.php;
15
16 server {
17 listen 80;
18 root /var/www/shaarli;
19
20 access_log /var/log/nginx/shaarli.access.log;
21 error_log /var/log/nginx/shaarli.error.log;
22
23 location ~ /\. {
24 # deny access to dotfiles
25 access_log off;
26 log_not_found off;
27 deny all;
28 }
29
30 location ~ ~$ {
31 # deny access to temp editor files, e.g. "script.php~"
32 access_log off;
33 log_not_found off;
34 deny all;
35 }
36
37 location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
38 # cache static assets
39 expires max;
40 add_header Pragma public;
41 add_header Cache-Control "public, must-revalidate, proxy-revalidate";
42 }
43
44 location ~ (index)\.php$ {
45 # filter and proxy PHP requests to PHP-FPM
46 fastcgi_pass unix:/var/run/php5-fpm.sock;
47 fastcgi_index index.php;
48 include fastcgi.conf;
49 }
50
51 location ~ \.php$ {
52 # deny access to all other PHP scripts
53 deny all;
54 }
55 }
56}
diff --git a/docker/production/stable/Dockerfile b/docker/production/stable/Dockerfile
new file mode 100644
index 00000000..2bb3948c
--- /dev/null
+++ b/docker/production/stable/Dockerfile
@@ -0,0 +1,20 @@
1FROM debian:jessie
2MAINTAINER Shaarli Community
3
4RUN apt-get update \
5 && apt-get install -y curl nginx-light php5-fpm php5-gd supervisor
6
7COPY nginx.conf /etc/nginx/nginx.conf
8COPY supervised.conf /etc/supervisor/conf.d/supervised.conf
9
10WORKDIR /var/www
11RUN rm -rf html \
12 && curl -L https://github.com/shaarli/Shaarli/archive/stable.tar.gz | tar xvzf - \
13 && mv Shaarli-stable shaarli \
14 && chown -R www-data:www-data shaarli
15
16VOLUME /var/www/shaarli/data
17
18EXPOSE 80
19
20CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"]
diff --git a/docker/production/stable/IMAGE.md b/docker/production/stable/IMAGE.md
new file mode 100644
index 00000000..d85b1d7a
--- /dev/null
+++ b/docker/production/stable/IMAGE.md
@@ -0,0 +1,5 @@
1## shaarli:stable
2- [Debian 8 Jessie](https://hub.docker.com/_/debian/)
3- [PHP5-FPM](http://php-fpm.org/)
4- [Nginx](http://nginx.org/)
5- [Shaarli (stable)](https://github.com/shaarli/Shaarli/tree/stable)
diff --git a/docker/production/stable/nginx.conf b/docker/production/stable/nginx.conf
new file mode 100644
index 00000000..e23c4587
--- /dev/null
+++ b/docker/production/stable/nginx.conf
@@ -0,0 +1,56 @@
1user www-data www-data;
2daemon off;
3worker_processes 4;
4
5events {
6 worker_connections 768;
7}
8
9http {
10 include mime.types;
11 default_type application/octet-stream;
12 keepalive_timeout 20;
13
14 index index.html index.php;
15
16 server {
17 listen 80;
18 root /var/www/shaarli;
19
20 access_log /var/log/nginx/shaarli.access.log;
21 error_log /var/log/nginx/shaarli.error.log;
22
23 location ~ /\. {
24 # deny access to dotfiles
25 access_log off;
26 log_not_found off;
27 deny all;
28 }
29
30 location ~ ~$ {
31 # deny access to temp editor files, e.g. "script.php~"
32 access_log off;
33 log_not_found off;
34 deny all;
35 }
36
37 location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
38 # cache static assets
39 expires max;
40 add_header Pragma public;
41 add_header Cache-Control "public, must-revalidate, proxy-revalidate";
42 }
43
44 location ~ (index)\.php$ {
45 # filter and proxy PHP requests to PHP-FPM
46 fastcgi_pass unix:/var/run/php5-fpm.sock;
47 fastcgi_index index.php;
48 include fastcgi.conf;
49 }
50
51 location ~ \.php$ {
52 # deny access to all other PHP scripts
53 deny all;
54 }
55 }
56}
diff --git a/docker/production/stable/supervised.conf b/docker/production/stable/supervised.conf
new file mode 100644
index 00000000..5acd9795
--- /dev/null
+++ b/docker/production/stable/supervised.conf
@@ -0,0 +1,13 @@
1[program:php5-fpm]
2command=/usr/sbin/php5-fpm -F
3priority=5
4autostart=true
5autorestart=true
6
7[program:nginx]
8command=/usr/sbin/nginx
9priority=10
10autostart=true
11autorestart=true
12stdout_events_enabled=true
13stderr_events_enabled=true
diff --git a/docker/production/supervised.conf b/docker/production/supervised.conf
new file mode 100644
index 00000000..5acd9795
--- /dev/null
+++ b/docker/production/supervised.conf
@@ -0,0 +1,13 @@
1[program:php5-fpm]
2command=/usr/sbin/php5-fpm -F
3priority=5
4autostart=true
5autorestart=true
6
7[program:nginx]
8command=/usr/sbin/nginx
9priority=10
10autostart=true
11autorestart=true
12stdout_events_enabled=true
13stderr_events_enabled=true
diff --git a/inc/shaarli.css b/inc/shaarli.css
index 451f0481..d6bbdbc1 100644
--- a/inc/shaarli.css
+++ b/inc/shaarli.css
@@ -739,25 +739,6 @@ h1 {
739 background: #ffffff; 739 background: #ffffff;
740} 740}
741 741
742div#permalinkQrcode {
743 padding: 20px;
744 width: 220px;
745 height: 220px;
746 background-color: #ffffff;
747 border: 1px solid black;
748 position: absolute;
749 top: -100px;
750 left: -100px;
751 text-align: center;
752 font-size: 8pt;
753 z-index: 50;
754 -webkit-box-shadow: 2px 2px 20px 2px #333333;
755 -moz-box-shadow: 2px 2px 20px 2px #333333;
756 -o-box-shadow: 2px 2px 20px 2px #333333;
757 -ms-box-shadow: 2px 2px 20px 2px #333333;
758 box-shadow: 2px 2px 20px 2px #333333;
759}
760
761div.daily { 742div.daily {
762 font-family: Georgia, 'DejaVu Serif', Norasi, serif; 743 font-family: Georgia, 'DejaVu Serif', Norasi, serif;
763 background-color: #E6D6BE; 744 background-color: #E6D6BE;
diff --git a/index.php b/index.php
index d0876d95..40a6fbe5 100644
--- a/index.php
+++ b/index.php
@@ -1,6 +1,6 @@
1<?php 1<?php
2/** 2/**
3 * Shaarli v0.6.1 - Shaare your links... 3 * Shaarli v0.6.2 - Shaare your links...
4 * 4 *
5 * The personal, minimalist, super-fast, no-database Delicious clone. 5 * The personal, minimalist, super-fast, no-database Delicious clone.
6 * 6 *
@@ -119,7 +119,7 @@ $GLOBALS['config']['PUBSUBHUB_URL'] = '';
119/* 119/*
120 * PHP configuration 120 * PHP configuration
121 */ 121 */
122define('shaarli_version', '0.6.1'); 122define('shaarli_version', '0.6.2');
123 123
124// http://server.com/x/shaarli --> /shaarli/ 124// http://server.com/x/shaarli --> /shaarli/
125define('WEB_PATH', substr($_SERVER["REQUEST_URI"], 0, 1+strrpos($_SERVER["REQUEST_URI"], '/', 0))); 125define('WEB_PATH', substr($_SERVER["REQUEST_URI"], 0, 1+strrpos($_SERVER["REQUEST_URI"], '/', 0)));
diff --git a/plugins/qrcode/qrcode.css b/plugins/qrcode/qrcode.css
new file mode 100755
index 00000000..0d514a0e
--- /dev/null
+++ b/plugins/qrcode/qrcode.css
@@ -0,0 +1,23 @@
1.linkqrcode {
2 display: inline;
3 position: relative;
4}
5
6#permalinkQrcode {
7 position: absolute;
8 z-index: 200;
9 padding: 20px;
10 width: 220px;
11 height: 220px;
12 background-color: #ffffff;
13 border: 1px solid black;
14 top: -110px;
15 left: -110px;
16 text-align: center;
17 font-size: 8pt;
18 box-shadow: 2px 2px 20px 2px #333333;
19}
20
21#permalinkQrcode img {
22 margin-bottom: 5px;
23}
diff --git a/plugins/qrcode/qrcode.html b/plugins/qrcode/qrcode.html
index 58ac5007..ffdaf3b8 100644
--- a/plugins/qrcode/qrcode.html
+++ b/plugins/qrcode/qrcode.html
@@ -1,3 +1,5 @@
1<a href="http://qrfree.kaywa.com/?l=1&amp;s=8&amp;d=%s" onclick="showQrCode(this); return false;" class="qrcode" data-permalink="%s"> 1<div class="linkqrcode">
2 <img src="%s/qrcode/qrcode.png" width="13" height="13" title="QR-Code"> 2 <a href="http://qrfree.kaywa.com/?l=1&amp;s=8&amp;d=%s" onclick="showQrCode(this); return false;" class="qrcode" data-permalink="%s">
3</a> 3 <img src="%s/qrcode/qrcode.png" width="13" height="13" title="QR-Code">
4 </a>
5</div>
diff --git a/plugins/qrcode/qrcode.php b/plugins/qrcode/qrcode.php
index 5f6e76a2..8bc610d1 100644
--- a/plugins/qrcode/qrcode.php
+++ b/plugins/qrcode/qrcode.php
@@ -17,7 +17,11 @@ function hook_qrcode_render_linklist($data)
17 $qrcode_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/qrcode/qrcode.html'); 17 $qrcode_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/qrcode/qrcode.html');
18 18
19 foreach ($data['links'] as &$value) { 19 foreach ($data['links'] as &$value) {
20 $qrcode = sprintf($qrcode_html, $value['real_url'], $value['real_url'], PluginManager::$PLUGINS_PATH); 20 $qrcode = sprintf($qrcode_html,
21 urlencode($value['url']),
22 $value['url'],
23 PluginManager::$PLUGINS_PATH
24 );
21 $value['link_plugin'][] = $qrcode; 25 $value['link_plugin'][] = $qrcode;
22 } 26 }
23 27
@@ -39,3 +43,19 @@ function hook_qrcode_render_footer($data)
39 43
40 return $data; 44 return $data;
41} 45}
46
47/**
48 * When linklist is displayed, include qrcode CSS file.
49 *
50 * @param array $data - header data.
51 *
52 * @return mixed - header data with qrcode CSS file added.
53 */
54function hook_qrcode_render_includes($data)
55{
56 if ($data['_PAGE_'] == Router::$PAGE_LINKLIST) {
57 $data['css_files'][] = PluginManager::$PLUGINS_PATH . '/qrcode/qrcode.css';
58 }
59
60 return $data;
61}
diff --git a/plugins/qrcode/shaarli-qrcode.js b/plugins/qrcode/shaarli-qrcode.js
index 0a8de21d..615f54c7 100644
--- a/plugins/qrcode/shaarli-qrcode.js
+++ b/plugins/qrcode/shaarli-qrcode.js
@@ -19,7 +19,7 @@ function showQrCode(caller,loading)
19 19
20 // Build the div which contains the QR-Code: 20 // Build the div which contains the QR-Code:
21 var element = document.createElement('div'); 21 var element = document.createElement('div');
22 element.id="permalinkQrcode"; 22 element.id = 'permalinkQrcode';
23 23
24 // Make QR-Code div commit sepuku when clicked: 24 // Make QR-Code div commit sepuku when clicked:
25 if ( element.attachEvent ){ 25 if ( element.attachEvent ){
@@ -37,6 +37,12 @@ function showQrCode(caller,loading)
37 element.appendChild(image); 37 element.appendChild(image);
38 element.innerHTML += "<br>Click to close"; 38 element.innerHTML += "<br>Click to close";
39 caller.parentNode.appendChild(element); 39 caller.parentNode.appendChild(element);
40
41 // Show the QRCode
42 qrcodeImage = document.getElementById('permalinkQrcode');
43 // Workaround to deal with newly created element lag for transition.
44 window.getComputedStyle(qrcodeImage).opacity;
45 qrcodeImage.className = 'show';
40 } 46 }
41 else 47 else
42 { 48 {
@@ -48,7 +54,7 @@ function showQrCode(caller,loading)
48// Remove any displayed QR-Code 54// Remove any displayed QR-Code
49function removeQrcode() 55function removeQrcode()
50{ 56{
51 var elem = document.getElementById("permalinkQrcode"); 57 var elem = document.getElementById('permalinkQrcode');
52 if (elem) { 58 if (elem) {
53 elem.parentNode.removeChild(elem); 59 elem.parentNode.removeChild(elem);
54 } 60 }
diff --git a/shaarli_version.php b/shaarli_version.php
index 11ad87d7..fe5f3896 100644
--- a/shaarli_version.php
+++ b/shaarli_version.php
@@ -1 +1 @@
<?php /* 0.6.1 */ ?> <?php /* 0.6.2 */ ?>
diff --git a/tests/plugins/PlugQrcodeTest.php b/tests/plugins/PlugQrcodeTest.php
index c749fa86..86dc7f29 100644
--- a/tests/plugins/PlugQrcodeTest.php
+++ b/tests/plugins/PlugQrcodeTest.php
@@ -30,7 +30,7 @@ class PlugQrcodeTest extends PHPUnit_Framework_TestCase
30 'title' => $str, 30 'title' => $str,
31 'links' => array( 31 'links' => array(
32 array( 32 array(
33 'real_url' => $str, 33 'url' => $str,
34 ) 34 )
35 ) 35 )
36 ); 36 );
@@ -39,7 +39,7 @@ class PlugQrcodeTest extends PHPUnit_Framework_TestCase
39 $link = $data['links'][0]; 39 $link = $data['links'][0];
40 // data shouldn't be altered 40 // data shouldn't be altered
41 $this->assertEquals($str, $data['title']); 41 $this->assertEquals($str, $data['title']);
42 $this->assertEquals($str, $link['real_url']); 42 $this->assertEquals($str, $link['url']);
43 43
44 // plugin data 44 // plugin data
45 $this->assertEquals(1, count($link['link_plugin'])); 45 $this->assertEquals(1, count($link['link_plugin']));