aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md13
-rw-r--r--application/.htaccess15
-rw-r--r--cache/.htaccess15
-rw-r--r--data/.htaccess15
-rw-r--r--docker/.htaccess15
-rw-r--r--docker/development/Dockerfile2
-rw-r--r--docker/development/nginx.conf7
-rw-r--r--docker/production/Dockerfile2
-rw-r--r--docker/production/nginx.conf7
-rw-r--r--docker/production/stable/Dockerfile2
-rw-r--r--docker/production/stable/nginx.conf7
-rw-r--r--inc/shaarli.css9
-rw-r--r--index.php1
-rw-r--r--pagecache/.htaccess15
-rw-r--r--plugins/archiveorg/archiveorg.html2
-rw-r--r--plugins/markdown/README.md38
-rw-r--r--plugins/markdown/markdown.meta5
-rw-r--r--plugins/markdown/markdown.php27
-rw-r--r--plugins/qrcode/qrcode.html2
-rw-r--r--plugins/readityourself/readityourself.html2
-rw-r--r--plugins/wallabag/wallabag.html2
-rw-r--r--tests/.htaccess15
-rw-r--r--tests/plugins/PluginMarkdownTest.php29
-rw-r--r--tmp/.htaccess15
-rw-r--r--tpl/editlink.html32
-rw-r--r--tpl/feed.atom.html4
-rw-r--r--tpl/includes.html3
-rw-r--r--tpl/pluginsadmin.html4
-rw-r--r--tpl/tools.html6
29 files changed, 252 insertions, 59 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d42d6a75..ffda8a1b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,20 +13,33 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
13- Plugins: 13- Plugins:
14 - Add an [Isso](https://posativ.org/isso/) plugin to enable user comments on permalinks 14 - Add an [Isso](https://posativ.org/isso/) plugin to enable user comments on permalinks
15 - Allow defining init functions, e.g. for performing checks and error processing 15 - Allow defining init functions, e.g. for performing checks and error processing
16 - Add a Piwik plugin for analytics.
17 - Markdown: add warning notice regarding HTML rendering
18- Meta tag to *not* send the referrer to external resources.
16 19
17### Changed 20### Changed
18- Cleanup `{loop}` declarations in templates 21- Cleanup `{loop}` declarations in templates
19- Release archives now have the same structure as GitHub-generated archives: 22- Release archives now have the same structure as GitHub-generated archives:
20 - archives contain a `Shaarli` directory, itself containing sources + dependencies 23 - archives contain a `Shaarli` directory, itself containing sources + dependencies
21 - the tarball is now gzipped 24 - the tarball is now gzipped
25- Plugins:
26 - Markdown: Parsedown library is now imported through Composer
22- Minor code cleanup: PHPDoc, spelling, unused variables, etc. 27- Minor code cleanup: PHPDoc, spelling, unused variables, etc.
28- Docker: explicitly set the maximum file upload size to 10 MiB
29- Tools: hide Firefox Social button when not in HTTPS
30- Firefox Social: show Shaarli's title when shaaring using Firefox Social
23 31
24### Fixed 32### Fixed
25- Fix the server `<self>` value in Atom/RSS feeds 33- Fix the server `<self>` value in Atom/RSS feeds
26- Plugins: 34- Plugins:
27 - Tools: only display parameter description when it exists 35 - Tools: only display parameter description when it exists
28 - archive.org: do not propose archival of private notes 36 - archive.org: do not propose archival of private notes
37 - Markdown:
38 - render links properly in code blocks
39 - bug regarding the `nomarkdown` tag
40 - W3C compliance
29- Use absolute URL for hashtags in RSS and ATOM feeds 41- Use absolute URL for hashtags in RSS and ATOM feeds
42- Docker: specify the location of the favicon
30 43
31### Security 44### Security
32- Allow whitelisting trusted IPs, else continue banning clients upon login failure 45- Allow whitelisting trusted IPs, else continue banning clients upon login failure
diff --git a/application/.htaccess b/application/.htaccess
index b584d98c..f601c1ee 100644
--- a/application/.htaccess
+++ b/application/.htaccess
@@ -1,2 +1,13 @@
1Allow from none 1<IfModule version_module>
2Deny from all 2 <IfVersion >= 2.4>
3 Require all denied
4 </IfVersion>
5 <IfVersion < 2.4>
6 Allow from none
7 Deny from all
8 </IfVersion>
9</IfModule>
10
11<IfModule !version_module>
12 Require all denied
13</IfModule>
diff --git a/cache/.htaccess b/cache/.htaccess
index b584d98c..f601c1ee 100644
--- a/cache/.htaccess
+++ b/cache/.htaccess
@@ -1,2 +1,13 @@
1Allow from none 1<IfModule version_module>
2Deny from all 2 <IfVersion >= 2.4>
3 Require all denied
4 </IfVersion>
5 <IfVersion < 2.4>
6 Allow from none
7 Deny from all
8 </IfVersion>
9</IfModule>
10
11<IfModule !version_module>
12 Require all denied
13</IfModule>
diff --git a/data/.htaccess b/data/.htaccess
index b584d98c..f601c1ee 100644
--- a/data/.htaccess
+++ b/data/.htaccess
@@ -1,2 +1,13 @@
1Allow from none 1<IfModule version_module>
2Deny from all 2 <IfVersion >= 2.4>
3 Require all denied
4 </IfVersion>
5 <IfVersion < 2.4>
6 Allow from none
7 Deny from all
8 </IfVersion>
9</IfModule>
10
11<IfModule !version_module>
12 Require all denied
13</IfModule>
diff --git a/docker/.htaccess b/docker/.htaccess
index b584d98c..f601c1ee 100644
--- a/docker/.htaccess
+++ b/docker/.htaccess
@@ -1,2 +1,13 @@
1Allow from none 1<IfModule version_module>
2Deny from all 2 <IfVersion >= 2.4>
3 Require all denied
4 </IfVersion>
5 <IfVersion < 2.4>
6 Allow from none
7 Deny from all
8 </IfVersion>
9</IfModule>
10
11<IfModule !version_module>
12 Require all denied
13</IfModule>
diff --git a/docker/development/Dockerfile b/docker/development/Dockerfile
index 0c19b085..d9ef8da7 100644
--- a/docker/development/Dockerfile
+++ b/docker/development/Dockerfile
@@ -15,6 +15,8 @@ RUN apt-get update \
15 nano \ 15 nano \
16 && apt-get clean 16 && apt-get clean
17 17
18RUN sed -i 's/post_max_size.*/post_max_size = 10M/' /etc/php5/fpm/php.ini
19RUN sed -i 's/upload_max_filesize.*/upload_max_filesize = 10M/' /etc/php5/fpm/php.ini
18COPY nginx.conf /etc/nginx/nginx.conf 20COPY nginx.conf /etc/nginx/nginx.conf
19COPY supervised.conf /etc/supervisor/conf.d/supervised.conf 21COPY supervised.conf /etc/supervisor/conf.d/supervised.conf
20 22
diff --git a/docker/development/nginx.conf b/docker/development/nginx.conf
index cda09b56..ac0c6c61 100644
--- a/docker/development/nginx.conf
+++ b/docker/development/nginx.conf
@@ -11,6 +11,8 @@ http {
11 default_type application/octet-stream; 11 default_type application/octet-stream;
12 keepalive_timeout 20; 12 keepalive_timeout 20;
13 13
14 client_max_body_size 10m;
15
14 index index.html index.php; 16 index index.html index.php;
15 17
16 server { 18 server {
@@ -49,6 +51,11 @@ http {
49 add_header Cache-Control "public, must-revalidate, proxy-revalidate"; 51 add_header Cache-Control "public, must-revalidate, proxy-revalidate";
50 } 52 }
51 53
54 location = /favicon.ico {
55 # serve the Shaarli favicon from its custom location
56 alias /var/www/shaarli/images/favicon.ico;
57 }
58
52 location ~ (index)\.php$ { 59 location ~ (index)\.php$ {
53 # filter and proxy PHP requests to PHP-FPM 60 # filter and proxy PHP requests to PHP-FPM
54 fastcgi_pass unix:/var/run/php5-fpm.sock; 61 fastcgi_pass unix:/var/run/php5-fpm.sock;
diff --git a/docker/production/Dockerfile b/docker/production/Dockerfile
index d93ed262..d0509115 100644
--- a/docker/production/Dockerfile
+++ b/docker/production/Dockerfile
@@ -14,6 +14,8 @@ RUN apt-get update \
14 supervisor \ 14 supervisor \
15 && apt-get clean 15 && apt-get clean
16 16
17RUN sed -i 's/post_max_size.*/post_max_size = 10M/' /etc/php5/fpm/php.ini
18RUN sed -i 's/upload_max_filesize.*/upload_max_filesize = 10M/' /etc/php5/fpm/php.ini
17COPY nginx.conf /etc/nginx/nginx.conf 19COPY nginx.conf /etc/nginx/nginx.conf
18COPY supervised.conf /etc/supervisor/conf.d/supervised.conf 20COPY supervised.conf /etc/supervisor/conf.d/supervised.conf
19 21
diff --git a/docker/production/nginx.conf b/docker/production/nginx.conf
index e23c4587..5ffa02d0 100644
--- a/docker/production/nginx.conf
+++ b/docker/production/nginx.conf
@@ -11,6 +11,8 @@ http {
11 default_type application/octet-stream; 11 default_type application/octet-stream;
12 keepalive_timeout 20; 12 keepalive_timeout 20;
13 13
14 client_max_body_size 10m;
15
14 index index.html index.php; 16 index index.html index.php;
15 17
16 server { 18 server {
@@ -41,6 +43,11 @@ http {
41 add_header Cache-Control "public, must-revalidate, proxy-revalidate"; 43 add_header Cache-Control "public, must-revalidate, proxy-revalidate";
42 } 44 }
43 45
46 location = /favicon.ico {
47 # serve the Shaarli favicon from its custom location
48 alias /var/www/shaarli/images/favicon.ico;
49 }
50
44 location ~ (index)\.php$ { 51 location ~ (index)\.php$ {
45 # filter and proxy PHP requests to PHP-FPM 52 # filter and proxy PHP requests to PHP-FPM
46 fastcgi_pass unix:/var/run/php5-fpm.sock; 53 fastcgi_pass unix:/var/run/php5-fpm.sock;
diff --git a/docker/production/stable/Dockerfile b/docker/production/stable/Dockerfile
index a509fda6..fc9588b0 100644
--- a/docker/production/stable/Dockerfile
+++ b/docker/production/stable/Dockerfile
@@ -14,6 +14,8 @@ RUN apt-get update \
14 supervisor \ 14 supervisor \
15 && apt-get clean 15 && apt-get clean
16 16
17RUN sed -i 's/post_max_size.*/post_max_size = 10M/' /etc/php5/fpm/php.ini
18RUN sed -i 's/upload_max_filesize.*/upload_max_filesize = 10M/' /etc/php5/fpm/php.ini
17COPY nginx.conf /etc/nginx/nginx.conf 19COPY nginx.conf /etc/nginx/nginx.conf
18COPY supervised.conf /etc/supervisor/conf.d/supervised.conf 20COPY supervised.conf /etc/supervisor/conf.d/supervised.conf
19 21
diff --git a/docker/production/stable/nginx.conf b/docker/production/stable/nginx.conf
index e23c4587..5ffa02d0 100644
--- a/docker/production/stable/nginx.conf
+++ b/docker/production/stable/nginx.conf
@@ -11,6 +11,8 @@ http {
11 default_type application/octet-stream; 11 default_type application/octet-stream;
12 keepalive_timeout 20; 12 keepalive_timeout 20;
13 13
14 client_max_body_size 10m;
15
14 index index.html index.php; 16 index index.html index.php;
15 17
16 server { 18 server {
@@ -41,6 +43,11 @@ http {
41 add_header Cache-Control "public, must-revalidate, proxy-revalidate"; 43 add_header Cache-Control "public, must-revalidate, proxy-revalidate";
42 } 44 }
43 45
46 location = /favicon.ico {
47 # serve the Shaarli favicon from its custom location
48 alias /var/www/shaarli/images/favicon.ico;
49 }
50
44 location ~ (index)\.php$ { 51 location ~ (index)\.php$ {
45 # filter and proxy PHP requests to PHP-FPM 52 # filter and proxy PHP requests to PHP-FPM
46 fastcgi_pass unix:/var/run/php5-fpm.sock; 53 fastcgi_pass unix:/var/run/php5-fpm.sock;
diff --git a/inc/shaarli.css b/inc/shaarli.css
index 5808320c..a24d4b7c 100644
--- a/inc/shaarli.css
+++ b/inc/shaarli.css
@@ -37,6 +37,10 @@ em {
37 font-style: italic; 37 font-style: italic;
38} 38}
39 39
40strong {
41 font-weight: bold;
42}
43
40/* Buttons */ 44/* Buttons */
41.bigbutton { 45.bigbutton {
42 background-color: #c0c0c0; 46 background-color: #c0c0c0;
@@ -1168,8 +1172,13 @@ ul.errors {
1168} 1172}
1169 1173
1170#pluginsadmin a { 1174#pluginsadmin a {
1175 color: #486D08;
1176}
1177
1178#pluginsadmin a.arrow {
1171 color: black; 1179 color: black;
1172} 1180}
1181
1173/* 404 page */ 1182/* 404 page */
1174.error-container { 1183.error-container {
1175 1184
diff --git a/index.php b/index.php
index 84282b8d..5366cb0e 100644
--- a/index.php
+++ b/index.php
@@ -1078,6 +1078,7 @@ function renderPage($conf, $pluginManager)
1078 { 1078 {
1079 $data = array( 1079 $data = array(
1080 'pageabsaddr' => index_url($_SERVER), 1080 'pageabsaddr' => index_url($_SERVER),
1081 'sslenabled' => !empty($_SERVER['HTTPS'])
1081 ); 1082 );
1082 $pluginManager->executeHooks('render_tools', $data); 1083 $pluginManager->executeHooks('render_tools', $data);
1083 1084
diff --git a/pagecache/.htaccess b/pagecache/.htaccess
index b584d98c..f601c1ee 100644
--- a/pagecache/.htaccess
+++ b/pagecache/.htaccess
@@ -1,2 +1,13 @@
1Allow from none 1<IfModule version_module>
2Deny from all 2 <IfVersion >= 2.4>
3 Require all denied
4 </IfVersion>
5 <IfVersion < 2.4>
6 Allow from none
7 Deny from all
8 </IfVersion>
9</IfModule>
10
11<IfModule !version_module>
12 Require all denied
13</IfModule>
diff --git a/plugins/archiveorg/archiveorg.html b/plugins/archiveorg/archiveorg.html
index 576bd46e..0781fe35 100644
--- a/plugins/archiveorg/archiveorg.html
+++ b/plugins/archiveorg/archiveorg.html
@@ -1 +1 @@
<span><a href="https://web.archive.org/web/%s"><img class="linklist-plugin-icon" src="plugins/archiveorg/internetarchive.png" title="View on archive.org" /></a></span> <span><a href="https://web.archive.org/web/%s"><img class="linklist-plugin-icon" src="plugins/archiveorg/internetarchive.png" title="View on archive.org" alt="archive.org" /></a></span>
diff --git a/plugins/markdown/README.md b/plugins/markdown/README.md
index 4f021871..aafcf066 100644
--- a/plugins/markdown/README.md
+++ b/plugins/markdown/README.md
@@ -20,26 +20,52 @@ The directory structure should look like:
20 |--- markdown.css 20 |--- markdown.css
21 |--- markdown.meta 21 |--- markdown.meta
22 |--- markdown.php 22 |--- markdown.php
23 |--- Parsedown.php
24 |--- README.md 23 |--- README.md
25``` 24```
26 25
27To enable the plugin, just check it in the plugin administration page. 26To enable the plugin, just check it in the plugin administration page.
28 27
29You can also add `markdown` to your list of enabled plugins in `data/config.php` 28You can also add `markdown` to your list of enabled plugins in `data/config.json.php`
30(`ENABLED_PLUGINS` array). 29(`general.enabled_plugins` list).
31 30
32This should look like: 31This should look like:
33 32
34``` 33```
35$GLOBALS['config']['ENABLED_PLUGINS'] = array('qrcode', 'any_other_plugin', 'markdown') 34"general": {
35 "enabled_plugins": [
36 "markdown",
37 [...]
38 ],
39}
36``` 40```
37 41
42Parsedown parsing library is imported using Composer. If you installed Shaarli using `git`,
43or the `master` branch, run
44
45 composer update --no-dev --prefer-dist
46
38### No Markdown tag 47### No Markdown tag
39 48
40If the tag `.nomarkdown` is set for a shaare, it won't be converted to Markdown syntax. 49If the tag `nomarkdown` is set for a shaare, it won't be converted to Markdown syntax.
41 50
42> Note: it's a private tag (leading dot), so it won't be displayed to visitors. 51> Note: this is a special tag, so it won't be displayed in link list.
52
53### HTML rendering
54
55Markdown support HTML tags. For example:
56
57 > <strong>strong</strong><strike>strike</strike>
58
59Will render as:
60
61> <strong>strong</strong><strike>strike</strike>
62
63If you want to shaare HTML code, it is necessary to use inline code or code blocks.
64
65**If your shaared descriptions containing HTML tags before enabling the markdown plugin,
66enabling it might break your page.**
67
68> Note: HTML tags such as script, iframe, etc. are disabled for security reasons.
43 69
44### Known issue 70### Known issue
45 71
diff --git a/plugins/markdown/markdown.meta b/plugins/markdown/markdown.meta
index e3904ed8..8df2ed0b 100644
--- a/plugins/markdown/markdown.meta
+++ b/plugins/markdown/markdown.meta
@@ -1 +1,4 @@
1description="Render shaare description with Markdown syntax." 1description="Render shaare description with Markdown syntax.<br><strong>Warning</strong>:
2If your shaared descriptions containing HTML tags before enabling the markdown plugin,
3enabling it might break your page.
4See the <a href=\"https://github.com/shaarli/Shaarli/tree/master/plugins/markdown#html-rendering\">README</a>."
diff --git a/plugins/markdown/markdown.php b/plugins/markdown/markdown.php
index a764b6fa..0cf6e6e2 100644
--- a/plugins/markdown/markdown.php
+++ b/plugins/markdown/markdown.php
@@ -22,7 +22,7 @@ function hook_markdown_render_linklist($data)
22{ 22{
23 foreach ($data['links'] as &$value) { 23 foreach ($data['links'] as &$value) {
24 if (!empty($value['tags']) && noMarkdownTag($value['tags'])) { 24 if (!empty($value['tags']) && noMarkdownTag($value['tags'])) {
25 $value['taglist'] = stripNoMarkdownTag($value['taglist']); 25 $value = stripNoMarkdownTag($value);
26 continue; 26 continue;
27 } 27 }
28 $value['description'] = process_markdown($value['description']); 28 $value['description'] = process_markdown($value['description']);
@@ -41,7 +41,7 @@ function hook_markdown_render_feed($data)
41{ 41{
42 foreach ($data['links'] as &$value) { 42 foreach ($data['links'] as &$value) {
43 if (!empty($value['tags']) && noMarkdownTag($value['tags'])) { 43 if (!empty($value['tags']) && noMarkdownTag($value['tags'])) {
44 $value['tags'] = stripNoMarkdownTag($value['tags']); 44 $value = stripNoMarkdownTag($value);
45 continue; 45 continue;
46 } 46 }
47 $value['description'] = process_markdown($value['description']); 47 $value['description'] = process_markdown($value['description']);
@@ -63,6 +63,7 @@ function hook_markdown_render_daily($data)
63 foreach ($data['cols'] as &$value) { 63 foreach ($data['cols'] as &$value) {
64 foreach ($value as &$value2) { 64 foreach ($value as &$value2) {
65 if (!empty($value2['tags']) && noMarkdownTag($value2['tags'])) { 65 if (!empty($value2['tags']) && noMarkdownTag($value2['tags'])) {
66 $value2 = stripNoMarkdownTag($value2);
66 continue; 67 continue;
67 } 68 }
68 $value2['formatedDescription'] = process_markdown($value2['formatedDescription']); 69 $value2['formatedDescription'] = process_markdown($value2['formatedDescription']);
@@ -81,20 +82,30 @@ function hook_markdown_render_daily($data)
81 */ 82 */
82function noMarkdownTag($tags) 83function noMarkdownTag($tags)
83{ 84{
84 return strpos($tags, NO_MD_TAG) !== false; 85 return preg_match('/(^|\s)'. NO_MD_TAG .'(\s|$)/', $tags);
85} 86}
86 87
87/** 88/**
88 * Remove the no-markdown meta tag so it won't be displayed. 89 * Remove the no-markdown meta tag so it won't be displayed.
89 * 90 *
90 * @param string $tags Tag list. 91 * @param array $link Link data.
91 * 92 *
92 * @return string tag list without no markdown tag. 93 * @return array Updated link without no markdown tag.
93 */ 94 */
94function stripNoMarkdownTag($tags) 95function stripNoMarkdownTag($link)
95{ 96{
96 unset($tags[array_search(NO_MD_TAG, $tags)]); 97 if (! empty($link['taglist'])) {
97 return array_values($tags); 98 $offset = array_search(NO_MD_TAG, $link['taglist']);
99 if ($offset !== false) {
100 unset($link['taglist'][$offset]);
101 }
102 }
103
104 if (!empty($link['tags'])) {
105 str_replace(NO_MD_TAG, '', $link['tags']);
106 }
107
108 return $link;
98} 109}
99 110
100/** 111/**
diff --git a/plugins/qrcode/qrcode.html b/plugins/qrcode/qrcode.html
index cebc5644..dc214ed1 100644
--- a/plugins/qrcode/qrcode.html
+++ b/plugins/qrcode/qrcode.html
@@ -1,5 +1,5 @@
1<div class="linkqrcode"> 1<div class="linkqrcode">
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"> 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 <img src="%s/qrcode/qrcode.png" class="linklist-plugin-icon" title="QR-Code"> 3 <img src="%s/qrcode/qrcode.png" class="linklist-plugin-icon" title="QR-Code" alt="QRCode">
4 </a> 4 </a>
5</div> 5</div>
diff --git a/plugins/readityourself/readityourself.html b/plugins/readityourself/readityourself.html
index e8c5f784..5e200715 100644
--- a/plugins/readityourself/readityourself.html
+++ b/plugins/readityourself/readityourself.html
@@ -1 +1 @@
<span><a href="%s?url=%s"><img class="linklist-plugin-icon" src="%s/readityourself/book-open.png" title="Read with Readityourself" /></a></span> <span><a href="%s?url=%s"><img class="linklist-plugin-icon" src="%s/readityourself/book-open.png" title="Read with Readityourself" alt="readityourself" /></a></span>
diff --git a/plugins/wallabag/wallabag.html b/plugins/wallabag/wallabag.html
index c7b1d044..e861536d 100644
--- a/plugins/wallabag/wallabag.html
+++ b/plugins/wallabag/wallabag.html
@@ -1 +1 @@
<span><a href="%s%s" target="_blank"><img class="linklist-plugin-icon" src="%s/wallabag/wallabag.png" title="Save to wallabag" /></a></span> <span><a href="%s%s" target="_blank"><img class="linklist-plugin-icon" src="%s/wallabag/wallabag.png" title="Save to wallabag" alt="wallabag" /></a></span>
diff --git a/tests/.htaccess b/tests/.htaccess
index b584d98c..f601c1ee 100644
--- a/tests/.htaccess
+++ b/tests/.htaccess
@@ -1,2 +1,13 @@
1Allow from none 1<IfModule version_module>
2Deny from all 2 <IfVersion >= 2.4>
3 Require all denied
4 </IfVersion>
5 <IfVersion < 2.4>
6 Allow from none
7 Deny from all
8 </IfVersion>
9</IfModule>
10
11<IfModule !version_module>
12 Require all denied
13</IfModule>
diff --git a/tests/plugins/PluginMarkdownTest.php b/tests/plugins/PluginMarkdownTest.php
index 12bdda24..17ef2280 100644
--- a/tests/plugins/PluginMarkdownTest.php
+++ b/tests/plugins/PluginMarkdownTest.php
@@ -8,8 +8,8 @@ require_once 'application/Utils.php';
8require_once 'plugins/markdown/markdown.php'; 8require_once 'plugins/markdown/markdown.php';
9 9
10/** 10/**
11 * Class PlugQrcodeTest 11 * Class PluginMarkdownTest
12 * Unit test for the QR-Code plugin 12 * Unit test for the Markdown plugin
13 */ 13 */
14class PluginMarkdownTest extends PHPUnit_Framework_TestCase 14class PluginMarkdownTest extends PHPUnit_Framework_TestCase
15{ 15{
@@ -130,8 +130,11 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase
130 )) 130 ))
131 ); 131 );
132 132
133 $data = hook_markdown_render_linklist($data); 133 $processed = hook_markdown_render_linklist($data);
134 $this->assertEquals($str, $data['links'][0]['description']); 134 $this->assertEquals($str, $processed['links'][0]['description']);
135
136 $processed = hook_markdown_render_feed($data);
137 $this->assertEquals($str, $processed['links'][0]['description']);
135 138
136 $data = array( 139 $data = array(
137 // Columns data 140 // Columns data
@@ -153,6 +156,24 @@ class PluginMarkdownTest extends PHPUnit_Framework_TestCase
153 } 156 }
154 157
155 /** 158 /**
159 * Test that a close value to nomarkdown is not understand as nomarkdown (previous value `.nomarkdown`).
160 */
161 function testNoMarkdownNotExcactlyMatching()
162 {
163 $str = 'All _work_ and `no play` makes Jack a *dull* boy.';
164 $data = array(
165 'links' => array(array(
166 'description' => $str,
167 'tags' => '.' . NO_MD_TAG,
168 'taglist' => array('.'. NO_MD_TAG),
169 ))
170 );
171
172 $data = hook_markdown_render_feed($data);
173 $this->assertContains('<em>', $data['links'][0]['description']);
174 }
175
176 /**
156 * Test hashtag links processed with markdown. 177 * Test hashtag links processed with markdown.
157 */ 178 */
158 function testMarkdownHashtagLinks() 179 function testMarkdownHashtagLinks()
diff --git a/tmp/.htaccess b/tmp/.htaccess
index b584d98c..f601c1ee 100644
--- a/tmp/.htaccess
+++ b/tmp/.htaccess
@@ -1,2 +1,13 @@
1Allow from none 1<IfModule version_module>
2Deny from all 2 <IfVersion >= 2.4>
3 Require all denied
4 </IfVersion>
5 <IfVersion < 2.4>
6 Allow from none
7 Deny from all
8 </IfVersion>
9</IfModule>
10
11<IfModule !version_module>
12 Require all denied
13</IfModule>
diff --git a/tpl/editlink.html b/tpl/editlink.html
index 441b5302..9e7621db 100644
--- a/tpl/editlink.html
+++ b/tpl/editlink.html
@@ -8,13 +8,15 @@
8{elseif="$link.description==''"}onload="document.linkform.lf_description.focus();" 8{elseif="$link.description==''"}onload="document.linkform.lf_description.focus();"
9{else}onload="document.linkform.lf_tags.focus();"{/if} > 9{else}onload="document.linkform.lf_tags.focus();"{/if} >
10<div id="pageheader"> 10<div id="pageheader">
11 {if="$source !== 'firefoxsocialapi'"} 11 {if="$source !== 'firefoxsocialapi'"}
12 {include="page.header"} 12 {include="page.header"}
13 {/if} 13 {else}
14 <div id="editlinkform"> 14 <div id="shaarli_title"><a href="{$titleLink}">{$shaarlititle}</a></div>
15 <form method="post" name="linkform"> 15 {/if}
16 <input type="hidden" name="lf_linkdate" value="{$link.linkdate}"> 16 <div id="editlinkform">
17 <label for="lf_url"><i>URL</i></label><br><input type="text" name="lf_url" id="lf_url" value="{$link.url}" class="lf_input"><br> 17 <form method="post" name="linkform">
18 <input type="hidden" name="lf_linkdate" value="{$link.linkdate}">
19 <label for="lf_url"><i>URL</i></label><br><input type="text" name="lf_url" id="lf_url" value="{$link.url}" class="lf_input"><br>
18 <label for="lf_title"><i>Title</i></label><br><input type="text" name="lf_title" id="lf_title" value="{$link.title}" class="lf_input"><br> 20 <label for="lf_title"><i>Title</i></label><br><input type="text" name="lf_title" id="lf_title" value="{$link.title}" class="lf_input"><br>
19 <label for="lf_description"><i>Description</i></label><br><textarea name="lf_description" id="lf_description" rows="4" cols="25">{$link.description}</textarea><br> 21 <label for="lf_description"><i>Description</i></label><br><textarea name="lf_description" id="lf_description" rows="4" cols="25">{$link.description}</textarea><br>
20 <label for="lf_tags"><i>Tags</i></label><br> 22 <label for="lf_tags"><i>Tags</i></label><br>
@@ -25,20 +27,20 @@
25 {$value} 27 {$value}
26 {/loop} 28 {/loop}
27 29
28 {if="($link_is_new && $default_private_links) || $link.private == true"} 30 {if="($link_is_new && $default_private_links) || $link.private == true"}
29 <input type="checkbox" checked="checked" name="lf_private" id="lf_private"> 31 <input type="checkbox" checked="checked" name="lf_private" id="lf_private">
30 &nbsp;<label for="lf_private"><i>Private</i></label><br> 32 &nbsp;<label for="lf_private"><i>Private</i></label><br>
31 {else} 33 {else}
32 <input type="checkbox" name="lf_private" id="lf_private"> 34 <input type="checkbox" name="lf_private" id="lf_private">
33 &nbsp;<label for="lf_private"><i>Private</i></label><br> 35 &nbsp;<label for="lf_private"><i>Private</i></label><br>
34 {/if} 36 {/if}
35 <input type="submit" value="Save" name="save_edit" class="bigbutton"> 37 <input type="submit" value="Save" name="save_edit" class="bigbutton">
36 <input type="submit" value="Cancel" name="cancel_edit" class="bigbutton"> 38 <input type="submit" value="Cancel" name="cancel_edit" class="bigbutton">
37 {if="!$link_is_new"}<input type="submit" value="Delete" name="delete_link" class="bigbutton delete" onClick="return confirmDeleteLink();">{/if} 39 {if="!$link_is_new"}<input type="submit" value="Delete" name="delete_link" class="bigbutton delete" onClick="return confirmDeleteLink();">{/if}
38 <input type="hidden" name="token" value="{$token}"> 40 <input type="hidden" name="token" value="{$token}">
39 {if="$http_referer"}<input type="hidden" name="returnurl" value="{$http_referer}">{/if} 41 {if="$http_referer"}<input type="hidden" name="returnurl" value="{$http_referer}">{/if}
40 </form> 42 </form>
41 </div> 43 </div>
42</div> 44</div>
43{if="$source !== 'firefoxsocialapi'"} 45{if="$source !== 'firefoxsocialapi'"}
44{include="page.footer"} 46{include="page.footer"}
diff --git a/tpl/feed.atom.html b/tpl/feed.atom.html
index 40fd421a..aead0459 100644
--- a/tpl/feed.atom.html
+++ b/tpl/feed.atom.html
@@ -30,9 +30,7 @@
30 <published>{$value.pub_iso_date}</published> 30 <published>{$value.pub_iso_date}</published>
31 <updated>{$value.up_iso_date}</updated> 31 <updated>{$value.up_iso_date}</updated>
32 {/if} 32 {/if}
33 <content type="html" xml:lang="{$language}"> 33 <content type="html" xml:lang="{$language}"><![CDATA[{$value.description}]]></content>
34 <![CDATA[{$value.description}]]>
35 </content>
36 {loop="$value.taglist"} 34 {loop="$value.taglist"}
37 <category scheme="{$index_url}?searchtags=" term="{$value|strtolower}" label="{$value}" /> 35 <category scheme="{$index_url}?searchtags=" term="{$value|strtolower}" label="{$value}" />
38 {/loop} 36 {/loop}
diff --git a/tpl/includes.html b/tpl/includes.html
index f94ce1be..7b2997ce 100644
--- a/tpl/includes.html
+++ b/tpl/includes.html
@@ -2,6 +2,7 @@
2<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 2<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
3<meta name="format-detection" content="telephone=no" /> 3<meta name="format-detection" content="telephone=no" />
4<meta name="viewport" content="width=device-width,initial-scale=1.0" /> 4<meta name="viewport" content="width=device-width,initial-scale=1.0" />
5<meta name="referrer" content="same-origin">
5<link rel="alternate" type="application/rss+xml" href="{$feedurl}?do=rss{$searchcrits}#" title="RSS Feed" /> 6<link rel="alternate" type="application/rss+xml" href="{$feedurl}?do=rss{$searchcrits}#" title="RSS Feed" />
6<link rel="alternate" type="application/atom+xml" href="{$feedurl}?do=atom{$searchcrits}#" title="ATOM Feed" /> 7<link rel="alternate" type="application/atom+xml" href="{$feedurl}?do=atom{$searchcrits}#" title="ATOM Feed" />
7<link href="images/favicon.ico#" rel="shortcut icon" type="image/x-icon" /> 8<link href="images/favicon.ico#" rel="shortcut icon" type="image/x-icon" />
@@ -11,4 +12,4 @@
11{loop="$plugins_includes.css_files"} 12{loop="$plugins_includes.css_files"}
12<link type="text/css" rel="stylesheet" href="{$value}#"/> 13<link type="text/css" rel="stylesheet" href="{$value}#"/>
13{/loop} 14{/loop}
14<link rel="search" type="application/opensearchdescription+xml" href="?do=opensearch#" title="Shaarli search - {$shaarlititle|htmlspecialchars}"/> \ No newline at end of file 15<link rel="search" type="application/opensearchdescription+xml" href="?do=opensearch#" title="Shaarli search - {$shaarlititle|htmlspecialchars}"/>
diff --git a/tpl/pluginsadmin.html b/tpl/pluginsadmin.html
index 672f4993..ead1734e 100644
--- a/tpl/pluginsadmin.html
+++ b/tpl/pluginsadmin.html
@@ -38,11 +38,11 @@
38 <tr data-line="{$key}" data-order="{$counter}"> 38 <tr data-line="{$key}" data-order="{$counter}">
39 <td class="center"><input type="checkbox" name="{$key}" id="{$key}" checked="checked"></td> 39 <td class="center"><input type="checkbox" name="{$key}" id="{$key}" checked="checked"></td>
40 <td class="center"> 40 <td class="center">
41 <a href="#" 41 <a href="#" class="arrow"
42 onclick="return orderUp(this.parentNode.parentNode.getAttribute('data-order'));"> 42 onclick="return orderUp(this.parentNode.parentNode.getAttribute('data-order'));">
43 43
44 </a> 44 </a>
45 <a href="#" 45 <a href="#" class="arrow"
46 onclick="return orderDown(this.parentNode.parentNode.getAttribute('data-order'));"> 46 onclick="return orderDown(this.parentNode.parentNode.getAttribute('data-order'));">
47 47
48 </a> 48 </a>
diff --git a/tpl/tools.html b/tpl/tools.html
index 8e285f44..e06d239d 100644
--- a/tpl/tools.html
+++ b/tpl/tools.html
@@ -50,12 +50,15 @@
50 &nbsp;&nbsp;&nbsp;&nbsp;Then click "✚Add Note" button anytime to start composing a private Note (text post) to your Shaarli. 50 &nbsp;&nbsp;&nbsp;&nbsp;Then click "✚Add Note" button anytime to start composing a private Note (text post) to your Shaarli.
51 </span> 51 </span>
52 </a><br><br> 52 </a><br><br>
53
54 {if="$sslenabled"}
53 <a class="smallbutton" onclick="activateFirefoxSocial(this)"> 55 <a class="smallbutton" onclick="activateFirefoxSocial(this)">
54 <b>✚Add to Firefox social</b> 56 <b>✚Add to Firefox social</b>
55 </a> 57 </a>
56 <a href="#"> 58 <a href="#">
57 <span>&#x21D0; Click on this button to add Shaarli to the "Share this page" button in Firefox.</span> 59 <span>&#x21D0; Click on this button to add Shaarli to the "Share this page" button in Firefox.</span>
58 </a><br><br> 60 </a><br><br>
61 {/if}
59 62
60 {loop="$tools_plugin"} 63 {loop="$tools_plugin"}
61 {$value} 64 {$value}
@@ -64,6 +67,7 @@
64 <div class="clear"></div> 67 <div class="clear"></div>
65 68
66 <script> 69 <script>
70 {if="$sslenabled"}
67 function activateFirefoxSocial(node) { 71 function activateFirefoxSocial(node) {
68 var loc = location.href; 72 var loc = location.href;
69 var baseURL = loc.substring(0, loc.lastIndexOf("/")); 73 var baseURL = loc.substring(0, loc.lastIndexOf("/"));
@@ -87,7 +91,7 @@
87 var activate = new CustomEvent("ActivateSocialFeature"); 91 var activate = new CustomEvent("ActivateSocialFeature");
88 node.dispatchEvent(activate); 92 node.dispatchEvent(activate);
89 } 93 }
90 94 {/if}
91 function alertBookmarklet() { 95 function alertBookmarklet() {
92 alert('Drag this link to your bookmarks toolbar, or right-click it and choose Bookmark This Link...'); 96 alert('Drag this link to your bookmarks toolbar, or right-click it and choose Bookmark This Link...');
93 return false; 97 return false;