diff options
-rw-r--r-- | .htaccess | 4 | ||||
-rw-r--r-- | CHANGELOG.md | 7 | ||||
-rw-r--r-- | Doxyfile | 1 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | application/FileUtils.php | 2 | ||||
-rw-r--r-- | application/LinkFilter.php | 8 | ||||
-rw-r--r-- | application/NetscapeBookmarkUtils.php | 4 | ||||
-rw-r--r-- | application/Updater.php | 26 | ||||
-rw-r--r-- | application/Url.php | 2 | ||||
-rw-r--r-- | application/api/controllers/History.php | 4 | ||||
-rw-r--r-- | application/api/controllers/Links.php | 4 | ||||
-rw-r--r-- | doc/md/Download-and-Installation.md | 6 | ||||
-rw-r--r-- | doc/md/Upgrade-and-migration.md | 2 | ||||
-rw-r--r-- | docker/alpine/Dockerfile.armhf.latest | 4 | ||||
-rw-r--r-- | docker/alpine/Dockerfile.armhf.master | 4 | ||||
-rw-r--r-- | docker/alpine/Dockerfile.latest | 5 | ||||
-rw-r--r-- | docker/alpine/Dockerfile.master | 5 | ||||
-rw-r--r-- | index.php | 13 | ||||
-rw-r--r-- | plugins/markdown/markdown.php | 2 | ||||
-rw-r--r-- | tests/Updater/UpdaterTest.php | 64 | ||||
-rw-r--r-- | tests/plugins/test/test.php | 2 | ||||
-rw-r--r-- | tpl/vintage/loginform.html | 2 |
23 files changed, 147 insertions, 30 deletions
@@ -6,6 +6,10 @@ RewriteEngine On | |||
6 | # Prevent accessing subdirectories not managed by SCM | 6 | # Prevent accessing subdirectories not managed by SCM |
7 | RewriteRule ^(.git|doxygen|vendor) - [F] | 7 | RewriteRule ^(.git|doxygen|vendor) - [F] |
8 | 8 | ||
9 | # Forward the "Authorization" HTTP header | ||
10 | RewriteCond %{HTTP:Authorization} ^(.*) | ||
11 | RewriteRule .* - [e=HTTP_AUTHORIZATION:%1] | ||
12 | |||
9 | # REST API | 13 | # REST API |
10 | RewriteCond %{REQUEST_FILENAME} !-f | 14 | RewriteCond %{REQUEST_FILENAME} !-f |
11 | RewriteCond %{REQUEST_FILENAME} !-d | 15 | RewriteCond %{REQUEST_FILENAME} !-d |
diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e737d8c..3218f4d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md | |||
@@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/). | |||
6 | 6 | ||
7 | ## [v0.10.0](https://github.com/shaarli/Shaarli/releases/tag/v0.10.0) - UNPUBLISHED | 7 | ## [v0.10.0](https://github.com/shaarli/Shaarli/releases/tag/v0.10.0) - UNPUBLISHED |
8 | 8 | ||
9 | |||
10 | ## [v0.9.6](https://github.com/shaarli/Shaarli/releases/tag/v0.9.6) - 2018-03-25 | ||
11 | ## Changed | ||
12 | - htaccess: prevent accessing resources not managed by SCM | ||
13 | - htaccess: always forward the 'Authorization' HTTP header | ||
14 | |||
15 | |||
9 | ## [v0.9.5](https://github.com/shaarli/Shaarli/releases/tag/v0.9.5) - 2018-02-02 | 16 | ## [v0.9.5](https://github.com/shaarli/Shaarli/releases/tag/v0.9.5) - 2018-02-02 |
10 | ### Fixed | 17 | ### Fixed |
11 | - Fix a warning happening when `php-intl` is not installed on the system | 18 | - Fix a warning happening when `php-intl` is not installed on the system |
@@ -804,6 +804,7 @@ RECURSIVE = YES | |||
804 | # run. | 804 | # run. |
805 | 805 | ||
806 | EXCLUDE = vendor \ | 806 | EXCLUDE = vendor \ |
807 | data \ | ||
807 | tpl \ | 808 | tpl \ |
808 | inc \ | 809 | inc \ |
809 | doc \ | 810 | doc \ |
@@ -192,7 +192,7 @@ authors: | |||
192 | ### generate Doxygen documentation | 192 | ### generate Doxygen documentation |
193 | doxygen: clean | 193 | doxygen: clean |
194 | @rm -rf doxygen | 194 | @rm -rf doxygen |
195 | @( cat Doxyfile ; echo "PROJECT_NUMBER=`git describe`" ) | doxygen - | 195 | @doxygen Doxyfile |
196 | 196 | ||
197 | ### generate HTML documentation from Markdown pages with MkDocs | 197 | ### generate HTML documentation from Markdown pages with MkDocs |
198 | htmldoc: | 198 | htmldoc: |
@@ -206,4 +206,4 @@ htmldoc: | |||
206 | 206 | ||
207 | ### Generate Shaarli's translation compiled file (.mo) | 207 | ### Generate Shaarli's translation compiled file (.mo) |
208 | translate: | 208 | translate: |
209 | @find inc/languages/ -name shaarli.po -execdir msgfmt shaarli.po -o shaarli.mo \; \ No newline at end of file | 209 | @find inc/languages/ -name shaarli.po -execdir msgfmt shaarli.po -o shaarli.mo \; |
@@ -9,7 +9,7 @@ _It is designed to be personal (single-user), fast and handy._ | |||
9 | [![](https://img.shields.io/badge/stable-v0.8.6-blue.svg)](https://github.com/shaarli/Shaarli/releases/tag/v0.8.6) | 9 | [![](https://img.shields.io/badge/stable-v0.8.6-blue.svg)](https://github.com/shaarli/Shaarli/releases/tag/v0.8.6) |
10 | [![](https://img.shields.io/travis/shaarli/Shaarli/stable.svg?label=stable)](https://travis-ci.org/shaarli/Shaarli) | 10 | [![](https://img.shields.io/travis/shaarli/Shaarli/stable.svg?label=stable)](https://travis-ci.org/shaarli/Shaarli) |
11 | • | 11 | • |
12 | [![](https://img.shields.io/badge/latest-v0.9.5-blue.svg)](https://github.com/shaarli/Shaarli/releases/tag/v0.9.5) | 12 | [![](https://img.shields.io/badge/latest-v0.9.6-blue.svg)](https://github.com/shaarli/Shaarli/releases/tag/v0.9.6) |
13 | [![](https://img.shields.io/travis/shaarli/Shaarli/latest.svg?label=latest)](https://travis-ci.org/shaarli/Shaarli) | 13 | [![](https://img.shields.io/travis/shaarli/Shaarli/latest.svg?label=latest)](https://travis-ci.org/shaarli/Shaarli) |
14 | • | 14 | • |
15 | [![](https://img.shields.io/badge/master-v0.10.x-blue.svg)](https://github.com/shaarli/Shaarli) | 15 | [![](https://img.shields.io/badge/master-v0.10.x-blue.svg)](https://github.com/shaarli/Shaarli) |
diff --git a/application/FileUtils.php b/application/FileUtils.php index 918cb83b..b89ea12b 100644 --- a/application/FileUtils.php +++ b/application/FileUtils.php | |||
@@ -37,7 +37,7 @@ class FileUtils | |||
37 | if (is_file($file) && !is_writeable($file)) { | 37 | if (is_file($file) && !is_writeable($file)) { |
38 | // The datastore exists but is not writeable | 38 | // The datastore exists but is not writeable |
39 | throw new IOException($file); | 39 | throw new IOException($file); |
40 | } else if (!is_file($file) && !is_writeable(dirname($file))) { | 40 | } elseif (!is_file($file) && !is_writeable(dirname($file))) { |
41 | // The datastore does not exist and its parent directory is not writeable | 41 | // The datastore does not exist and its parent directory is not writeable |
42 | throw new IOException(dirname($file)); | 42 | throw new IOException(dirname($file)); |
43 | } | 43 | } |
diff --git a/application/LinkFilter.php b/application/LinkFilter.php index 12376e27..e52239b8 100644 --- a/application/LinkFilter.php +++ b/application/LinkFilter.php | |||
@@ -117,7 +117,7 @@ class LinkFilter | |||
117 | foreach ($this->links as $key => $value) { | 117 | foreach ($this->links as $key => $value) { |
118 | if ($value['private'] && $visibility === 'private') { | 118 | if ($value['private'] && $visibility === 'private') { |
119 | $out[$key] = $value; | 119 | $out[$key] = $value; |
120 | } else if (! $value['private'] && $visibility === 'public') { | 120 | } elseif (! $value['private'] && $visibility === 'public') { |
121 | $out[$key] = $value; | 121 | $out[$key] = $value; |
122 | } | 122 | } |
123 | } | 123 | } |
@@ -210,7 +210,7 @@ class LinkFilter | |||
210 | if ($visibility !== 'all') { | 210 | if ($visibility !== 'all') { |
211 | if (! $link['private'] && $visibility === 'private') { | 211 | if (! $link['private'] && $visibility === 'private') { |
212 | continue; | 212 | continue; |
213 | } else if ($link['private'] && $visibility === 'public') { | 213 | } elseif ($link['private'] && $visibility === 'public') { |
214 | continue; | 214 | continue; |
215 | } | 215 | } |
216 | } | 216 | } |
@@ -337,7 +337,7 @@ class LinkFilter | |||
337 | if ($visibility !== 'all') { | 337 | if ($visibility !== 'all') { |
338 | if (! $link['private'] && $visibility === 'private') { | 338 | if (! $link['private'] && $visibility === 'private') { |
339 | continue; | 339 | continue; |
340 | } else if ($link['private'] && $visibility === 'public') { | 340 | } elseif ($link['private'] && $visibility === 'public') { |
341 | continue; | 341 | continue; |
342 | } | 342 | } |
343 | } | 343 | } |
@@ -380,7 +380,7 @@ class LinkFilter | |||
380 | if ($visibility !== 'all') { | 380 | if ($visibility !== 'all') { |
381 | if (! $link['private'] && $visibility === 'private') { | 381 | if (! $link['private'] && $visibility === 'private') { |
382 | continue; | 382 | continue; |
383 | } else if ($link['private'] && $visibility === 'public') { | 383 | } elseif ($link['private'] && $visibility === 'public') { |
384 | continue; | 384 | continue; |
385 | } | 385 | } |
386 | } | 386 | } |
diff --git a/application/NetscapeBookmarkUtils.php b/application/NetscapeBookmarkUtils.php index 2aa2da3b..b4d16d00 100644 --- a/application/NetscapeBookmarkUtils.php +++ b/application/NetscapeBookmarkUtils.php | |||
@@ -154,10 +154,10 @@ class NetscapeBookmarkUtils | |||
154 | if (empty($post['privacy']) || $post['privacy'] == 'default') { | 154 | if (empty($post['privacy']) || $post['privacy'] == 'default') { |
155 | // use value from the imported file | 155 | // use value from the imported file |
156 | $private = $bkm['pub'] == '1' ? 0 : 1; | 156 | $private = $bkm['pub'] == '1' ? 0 : 1; |
157 | } else if ($post['privacy'] == 'private') { | 157 | } elseif ($post['privacy'] == 'private') { |
158 | // all imported links are private | 158 | // all imported links are private |
159 | $private = 1; | 159 | $private = 1; |
160 | } else if ($post['privacy'] == 'public') { | 160 | } elseif ($post['privacy'] == 'public') { |
161 | // all imported links are public | 161 | // all imported links are public |
162 | $private = 0; | 162 | $private = 0; |
163 | } | 163 | } |
diff --git a/application/Updater.php b/application/Updater.php index f07e7697..dece2c02 100644 --- a/application/Updater.php +++ b/application/Updater.php | |||
@@ -457,6 +457,32 @@ class Updater | |||
457 | } | 457 | } |
458 | return true; | 458 | return true; |
459 | } | 459 | } |
460 | |||
461 | /** | ||
462 | * Add download size and timeout to the configuration file | ||
463 | * | ||
464 | * @return bool true if the update is successful, false otherwise. | ||
465 | */ | ||
466 | public function updateMethodDownloadSizeAndTimeoutConf() | ||
467 | { | ||
468 | if ($this->conf->exists('general.download_max_size') | ||
469 | && $this->conf->exists('general.download_timeout') | ||
470 | ) { | ||
471 | return true; | ||
472 | } | ||
473 | |||
474 | if (! $this->conf->exists('general.download_max_size')) { | ||
475 | $this->conf->set('general.download_max_size', 1024*1024*4); | ||
476 | } | ||
477 | |||
478 | if (! $this->conf->exists('general.download_timeout')) { | ||
479 | $this->conf->set('general.download_timeout', 30); | ||
480 | } | ||
481 | |||
482 | $this->conf->write($this->isLoggedIn); | ||
483 | |||
484 | return true; | ||
485 | } | ||
460 | } | 486 | } |
461 | 487 | ||
462 | /** | 488 | /** |
diff --git a/application/Url.php b/application/Url.php index 21c17ecc..6b9870f0 100644 --- a/application/Url.php +++ b/application/Url.php | |||
@@ -81,7 +81,7 @@ function whitelist_protocols($url, $protocols) | |||
81 | // Protocol not allowed: we remove it and replace it with http | 81 | // Protocol not allowed: we remove it and replace it with http |
82 | if ($protocol === 1 && ! in_array($match[1], $protocols)) { | 82 | if ($protocol === 1 && ! in_array($match[1], $protocols)) { |
83 | $url = str_replace($match[0], 'http://', $url); | 83 | $url = str_replace($match[0], 'http://', $url); |
84 | } else if ($protocol !== 1) { | 84 | } elseif ($protocol !== 1) { |
85 | $url = 'http://' . $url; | 85 | $url = 'http://' . $url; |
86 | } | 86 | } |
87 | return $url; | 87 | return $url; |
diff --git a/application/api/controllers/History.php b/application/api/controllers/History.php index 2ff9deaf..5cc453bf 100644 --- a/application/api/controllers/History.php +++ b/application/api/controllers/History.php | |||
@@ -36,7 +36,7 @@ class History extends ApiController | |||
36 | if (empty($offset)) { | 36 | if (empty($offset)) { |
37 | $offset = 0; | 37 | $offset = 0; |
38 | } | 38 | } |
39 | else if (ctype_digit($offset)) { | 39 | elseif (ctype_digit($offset)) { |
40 | $offset = (int) $offset; | 40 | $offset = (int) $offset; |
41 | } else { | 41 | } else { |
42 | throw new ApiBadParametersException('Invalid offset'); | 42 | throw new ApiBadParametersException('Invalid offset'); |
@@ -46,7 +46,7 @@ class History extends ApiController | |||
46 | $limit = $request->getParam('limit'); | 46 | $limit = $request->getParam('limit'); |
47 | if (empty($limit)) { | 47 | if (empty($limit)) { |
48 | $limit = count($history); | 48 | $limit = count($history); |
49 | } else if (ctype_digit($limit)) { | 49 | } elseif (ctype_digit($limit)) { |
50 | $limit = (int) $limit; | 50 | $limit = (int) $limit; |
51 | } else { | 51 | } else { |
52 | throw new ApiBadParametersException('Invalid limit'); | 52 | throw new ApiBadParametersException('Invalid limit'); |
diff --git a/application/api/controllers/Links.php b/application/api/controllers/Links.php index eb78dd26..3a9c0355 100644 --- a/application/api/controllers/Links.php +++ b/application/api/controllers/Links.php | |||
@@ -59,9 +59,9 @@ class Links extends ApiController | |||
59 | $limit = $request->getParam('limit'); | 59 | $limit = $request->getParam('limit'); |
60 | if (empty($limit)) { | 60 | if (empty($limit)) { |
61 | $limit = self::$DEFAULT_LIMIT; | 61 | $limit = self::$DEFAULT_LIMIT; |
62 | } else if (ctype_digit($limit)) { | 62 | } elseif (ctype_digit($limit)) { |
63 | $limit = intval($limit); | 63 | $limit = intval($limit); |
64 | } else if ($limit === 'all') { | 64 | } elseif ($limit === 'all') { |
65 | $limit = count($links); | 65 | $limit = count($links); |
66 | } else { | 66 | } else { |
67 | throw new ApiBadParametersException('Invalid limit'); | 67 | throw new ApiBadParametersException('Invalid limit'); |
diff --git a/doc/md/Download-and-Installation.md b/doc/md/Download-and-Installation.md index 0fdbd27d..05f0c8f2 100644 --- a/doc/md/Download-and-Installation.md +++ b/doc/md/Download-and-Installation.md | |||
@@ -25,11 +25,11 @@ Using one of the following methods: | |||
25 | 25 | ||
26 | In most cases, you should download the latest Shaarli release from the [releases](https://github.com/shaarli/Shaarli/releases) page. **Download our *shaarli-full* archive** to include dependencies. | 26 | In most cases, you should download the latest Shaarli release from the [releases](https://github.com/shaarli/Shaarli/releases) page. **Download our *shaarli-full* archive** to include dependencies. |
27 | 27 | ||
28 | The current latest released version is `v0.9.3` | 28 | The current latest released version is `v0.9.6` |
29 | 29 | ||
30 | ```bash | 30 | ```bash |
31 | $ wget https://github.com/shaarli/Shaarli/releases/download/v0.9.3/shaarli-v0.9.3-full.zip | 31 | $ wget https://github.com/shaarli/Shaarli/releases/download/v0.9.6/shaarli-v0.9.6-full.zip |
32 | $ unzip shaarli-v0.9.3-full.zip | 32 | $ unzip shaarli-v0.9.6-full.zip |
33 | $ mv Shaarli /path/to/shaarli/ | 33 | $ mv Shaarli /path/to/shaarli/ |
34 | ``` | 34 | ``` |
35 | 35 | ||
diff --git a/doc/md/Upgrade-and-migration.md b/doc/md/Upgrade-and-migration.md index f666be75..ac24ff34 100644 --- a/doc/md/Upgrade-and-migration.md +++ b/doc/md/Upgrade-and-migration.md | |||
@@ -3,7 +3,7 @@ | |||
3 | ### Note your current version | 3 | ### Note your current version |
4 | 4 | ||
5 | If anything goes wrong, it's important for us to know which version you're upgrading from. | 5 | If anything goes wrong, it's important for us to know which version you're upgrading from. |
6 | The current version is present in the `version.php` file. | 6 | The current version is present in the `shaarli_version.php` file. |
7 | 7 | ||
8 | ### Backup your data | 8 | ### Backup your data |
9 | 9 | ||
diff --git a/docker/alpine/Dockerfile.armhf.latest b/docker/alpine/Dockerfile.armhf.latest index c923834a..824a1926 100644 --- a/docker/alpine/Dockerfile.armhf.latest +++ b/docker/alpine/Dockerfile.armhf.latest | |||
@@ -37,7 +37,9 @@ RUN curl -L https://github.com/shaarli/Shaarli/archive/latest.tar.gz | tar xzf - | |||
37 | && cd shaarli \ | 37 | && cd shaarli \ |
38 | && composer --prefer-dist --no-dev install \ | 38 | && composer --prefer-dist --no-dev install \ |
39 | && rm -rf ~/.composer \ | 39 | && rm -rf ~/.composer \ |
40 | && chown -R nginx:nginx . | 40 | && chown -R nginx:nginx . \ |
41 | && ln -sf /dev/stdout /var/log/nginx/shaarli.access.log \ | ||
42 | && ln -sf /dev/stderr /var/log/nginx/shaarli.error.log | ||
41 | 43 | ||
42 | VOLUME /var/www/shaarli/data | 44 | VOLUME /var/www/shaarli/data |
43 | 45 | ||
diff --git a/docker/alpine/Dockerfile.armhf.master b/docker/alpine/Dockerfile.armhf.master index 7f1bdf85..6c89adc3 100644 --- a/docker/alpine/Dockerfile.armhf.master +++ b/docker/alpine/Dockerfile.armhf.master | |||
@@ -37,7 +37,9 @@ RUN curl -L https://github.com/shaarli/Shaarli/archive/master.tar.gz | tar xzf - | |||
37 | && cd shaarli \ | 37 | && cd shaarli \ |
38 | && composer --prefer-dist --no-dev install \ | 38 | && composer --prefer-dist --no-dev install \ |
39 | && rm -rf ~/.composer \ | 39 | && rm -rf ~/.composer \ |
40 | && chown -R nginx:nginx . | 40 | && chown -R nginx:nginx . \ |
41 | && ln -sf /dev/stdout /var/log/nginx/shaarli.access.log \ | ||
42 | && ln -sf /dev/stderr /var/log/nginx/shaarli.error.log | ||
41 | 43 | ||
42 | VOLUME /var/www/shaarli/data | 44 | VOLUME /var/www/shaarli/data |
43 | 45 | ||
diff --git a/docker/alpine/Dockerfile.latest b/docker/alpine/Dockerfile.latest index e9015c13..755d8751 100644 --- a/docker/alpine/Dockerfile.latest +++ b/docker/alpine/Dockerfile.latest | |||
@@ -42,7 +42,12 @@ RUN rm -rf /etc/php7/php-fpm.d/www.conf \ | |||
42 | WORKDIR /var/www | 42 | WORKDIR /var/www |
43 | COPY --from=composer /app/shaarli shaarli | 43 | COPY --from=composer /app/shaarli shaarli |
44 | 44 | ||
45 | RUN chown -R nginx:nginx . \ | ||
46 | && ln -sf /dev/stdout /var/log/nginx/shaarli.access.log \ | ||
47 | && ln -sf /dev/stderr /var/log/nginx/shaarli.error.log | ||
48 | |||
45 | VOLUME /var/www/shaarli/data | 49 | VOLUME /var/www/shaarli/data |
50 | |||
46 | EXPOSE 80 | 51 | EXPOSE 80 |
47 | 52 | ||
48 | ENTRYPOINT ["/bin/s6-svscan", "/etc/services.d"] | 53 | ENTRYPOINT ["/bin/s6-svscan", "/etc/services.d"] |
diff --git a/docker/alpine/Dockerfile.master b/docker/alpine/Dockerfile.master index 9cb4dec4..0472947f 100644 --- a/docker/alpine/Dockerfile.master +++ b/docker/alpine/Dockerfile.master | |||
@@ -42,7 +42,10 @@ RUN rm -rf /etc/php7/php-fpm.d/www.conf \ | |||
42 | WORKDIR /var/www | 42 | WORKDIR /var/www |
43 | COPY --from=composer /app/shaarli shaarli | 43 | COPY --from=composer /app/shaarli shaarli |
44 | 44 | ||
45 | RUN chown -R nginx:nginx . | 45 | RUN chown -R nginx:nginx . \ |
46 | && ln -sf /dev/stdout /var/log/nginx/shaarli.access.log \ | ||
47 | && ln -sf /dev/stderr /var/log/nginx/shaarli.error.log | ||
48 | |||
46 | VOLUME /var/www/shaarli/data | 49 | VOLUME /var/www/shaarli/data |
47 | 50 | ||
48 | EXPOSE 80 | 51 | EXPOSE 80 |
@@ -887,7 +887,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, | |||
887 | if (empty($params['searchtags'])) { | 887 | if (empty($params['searchtags'])) { |
888 | $params['searchtags'] = trim($_GET['addtag']); | 888 | $params['searchtags'] = trim($_GET['addtag']); |
889 | } | 889 | } |
890 | else if ($addtag) { | 890 | elseif ($addtag) { |
891 | $params['searchtags'] = trim($params['searchtags']).' '.trim($_GET['addtag']); | 891 | $params['searchtags'] = trim($params['searchtags']).' '.trim($_GET['addtag']); |
892 | } | 892 | } |
893 | 893 | ||
@@ -953,7 +953,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, | |||
953 | } else { | 953 | } else { |
954 | unset($_SESSION['visibility']); | 954 | unset($_SESSION['visibility']); |
955 | } | 955 | } |
956 | } else if ($_GET['visibility'] === 'public') { | 956 | } elseif ($_GET['visibility'] === 'public') { |
957 | if (empty($_SESSION['visibility']) || $_SESSION['visibility'] !== 'public') { | 957 | if (empty($_SESSION['visibility']) || $_SESSION['visibility'] !== 'public') { |
958 | // See only public links | 958 | // See only public links |
959 | $_SESSION['visibility'] = 'public'; | 959 | $_SESSION['visibility'] = 'public'; |
@@ -1093,7 +1093,6 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, | |||
1093 | $conf->set('general.title', escape($_POST['title'])); | 1093 | $conf->set('general.title', escape($_POST['title'])); |
1094 | $conf->set('general.header_link', escape($_POST['titleLink'])); | 1094 | $conf->set('general.header_link', escape($_POST['titleLink'])); |
1095 | $conf->set('resource.theme', escape($_POST['theme'])); | 1095 | $conf->set('resource.theme', escape($_POST['theme'])); |
1096 | $conf->set('redirector.url', escape($_POST['redirector'])); | ||
1097 | $conf->set('security.session_protection_disabled', !empty($_POST['disablesessionprotection'])); | 1096 | $conf->set('security.session_protection_disabled', !empty($_POST['disablesessionprotection'])); |
1098 | $conf->set('privacy.default_private_links', !empty($_POST['privateLinkByDefault'])); | 1097 | $conf->set('privacy.default_private_links', !empty($_POST['privateLinkByDefault'])); |
1099 | $conf->set('feed.rss_permalinks', !empty($_POST['enableRssPermalinks'])); | 1098 | $conf->set('feed.rss_permalinks', !empty($_POST['enableRssPermalinks'])); |
@@ -1126,7 +1125,6 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, | |||
1126 | $PAGE->assign('title', $conf->get('general.title')); | 1125 | $PAGE->assign('title', $conf->get('general.title')); |
1127 | $PAGE->assign('theme', $conf->get('resource.theme')); | 1126 | $PAGE->assign('theme', $conf->get('resource.theme')); |
1128 | $PAGE->assign('theme_available', ThemeUtils::getThemes($conf->get('resource.raintpl_tpl'))); | 1127 | $PAGE->assign('theme_available', ThemeUtils::getThemes($conf->get('resource.raintpl_tpl'))); |
1129 | $PAGE->assign('redirector', $conf->get('redirector.url')); | ||
1130 | list($continents, $cities) = generateTimeZoneData( | 1128 | list($continents, $cities) = generateTimeZoneData( |
1131 | timezone_identifiers_list(), | 1129 | timezone_identifiers_list(), |
1132 | $conf->get('general.timezone') | 1130 | $conf->get('general.timezone') |
@@ -1376,7 +1374,12 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, | |||
1376 | if (empty($title) && strpos(get_url_scheme($url), 'http') !== false) { | 1374 | if (empty($title) && strpos(get_url_scheme($url), 'http') !== false) { |
1377 | // Short timeout to keep the application responsive | 1375 | // Short timeout to keep the application responsive |
1378 | // The callback will fill $charset and $title with data from the downloaded page. | 1376 | // The callback will fill $charset and $title with data from the downloaded page. |
1379 | get_http_response($url, 25, 4194304, get_curl_download_callback($charset, $title)); | 1377 | get_http_response( |
1378 | $url, | ||
1379 | $conf->get('general.download_max_size', 4194304), | ||
1380 | $conf->get('general.download_timeout', 30), | ||
1381 | get_curl_download_callback($charset, $title) | ||
1382 | ); | ||
1380 | if (! empty($title) && strtolower($charset) != 'utf-8') { | 1383 | if (! empty($title) && strtolower($charset) != 'utf-8') { |
1381 | $title = mb_convert_encoding($title, 'utf-8', $charset); | 1384 | $title = mb_convert_encoding($title, 'utf-8', $charset); |
1382 | } | 1385 | } |
diff --git a/plugins/markdown/markdown.php b/plugins/markdown/markdown.php index 6b4aabf3..2f24e417 100644 --- a/plugins/markdown/markdown.php +++ b/plugins/markdown/markdown.php | |||
@@ -288,7 +288,7 @@ function sanitize_html($description) | |||
288 | $description); | 288 | $description); |
289 | } | 289 | } |
290 | $description = preg_replace( | 290 | $description = preg_replace( |
291 | '#(<[^>]+)on[a-z]*="?[^ "]*"?#is', | 291 | '#(<[^>]+\s)on[a-z]*="?[^ "]*"?#is', |
292 | '$1', | 292 | '$1', |
293 | $description); | 293 | $description); |
294 | return $description; | 294 | return $description; |
diff --git a/tests/Updater/UpdaterTest.php b/tests/Updater/UpdaterTest.php index fed175df..94e3c7d3 100644 --- a/tests/Updater/UpdaterTest.php +++ b/tests/Updater/UpdaterTest.php | |||
@@ -620,4 +620,68 @@ $GLOBALS[\'privateLinkByDefault\'] = true;'; | |||
620 | $this->assertTrue($updater->updateMethodAtomDefault()); | 620 | $this->assertTrue($updater->updateMethodAtomDefault()); |
621 | $this->assertTrue($this->conf->get('feed.show_atom')); | 621 | $this->assertTrue($this->conf->get('feed.show_atom')); |
622 | } | 622 | } |
623 | |||
624 | /** | ||
625 | * Test updateMethodDownloadSizeAndTimeoutConf, it should be set if none is already defined. | ||
626 | */ | ||
627 | public function testUpdateMethodDownloadSizeAndTimeoutConf() | ||
628 | { | ||
629 | $sandboxConf = 'sandbox/config'; | ||
630 | copy(self::$configFile . '.json.php', $sandboxConf . '.json.php'); | ||
631 | $this->conf = new ConfigManager($sandboxConf); | ||
632 | $updater = new Updater([], [], $this->conf, true); | ||
633 | $this->assertTrue($updater->updateMethodDownloadSizeAndTimeoutConf()); | ||
634 | $this->assertEquals(4194304, $this->conf->get('general.download_max_size')); | ||
635 | $this->assertEquals(30, $this->conf->get('general.download_timeout')); | ||
636 | |||
637 | $this->conf = new ConfigManager($sandboxConf); | ||
638 | $this->assertEquals(4194304, $this->conf->get('general.download_max_size')); | ||
639 | $this->assertEquals(30, $this->conf->get('general.download_timeout')); | ||
640 | } | ||
641 | |||
642 | /** | ||
643 | * Test updateMethodDownloadSizeAndTimeoutConf, it shouldn't be set if it is already defined. | ||
644 | */ | ||
645 | public function testUpdateMethodDownloadSizeAndTimeoutConfIgnore() | ||
646 | { | ||
647 | $sandboxConf = 'sandbox/config'; | ||
648 | copy(self::$configFile . '.json.php', $sandboxConf . '.json.php'); | ||
649 | $this->conf = new ConfigManager($sandboxConf); | ||
650 | $this->conf->set('general.download_max_size', 38); | ||
651 | $this->conf->set('general.download_timeout', 70); | ||
652 | $updater = new Updater([], [], $this->conf, true); | ||
653 | $this->assertTrue($updater->updateMethodDownloadSizeAndTimeoutConf()); | ||
654 | $this->assertEquals(38, $this->conf->get('general.download_max_size')); | ||
655 | $this->assertEquals(70, $this->conf->get('general.download_timeout')); | ||
656 | } | ||
657 | |||
658 | /** | ||
659 | * Test updateMethodDownloadSizeAndTimeoutConf, only the maz size should be set here. | ||
660 | */ | ||
661 | public function testUpdateMethodDownloadSizeAndTimeoutConfOnlySize() | ||
662 | { | ||
663 | $sandboxConf = 'sandbox/config'; | ||
664 | copy(self::$configFile . '.json.php', $sandboxConf . '.json.php'); | ||
665 | $this->conf = new ConfigManager($sandboxConf); | ||
666 | $this->conf->set('general.download_max_size', 38); | ||
667 | $updater = new Updater([], [], $this->conf, true); | ||
668 | $this->assertTrue($updater->updateMethodDownloadSizeAndTimeoutConf()); | ||
669 | $this->assertEquals(38, $this->conf->get('general.download_max_size')); | ||
670 | $this->assertEquals(30, $this->conf->get('general.download_timeout')); | ||
671 | } | ||
672 | |||
673 | /** | ||
674 | * Test updateMethodDownloadSizeAndTimeoutConf, only the time out should be set here. | ||
675 | */ | ||
676 | public function testUpdateMethodDownloadSizeAndTimeoutConfOnlyTimeout() | ||
677 | { | ||
678 | $sandboxConf = 'sandbox/config'; | ||
679 | copy(self::$configFile . '.json.php', $sandboxConf . '.json.php'); | ||
680 | $this->conf = new ConfigManager($sandboxConf); | ||
681 | $this->conf->set('general.download_timeout', 3); | ||
682 | $updater = new Updater([], [], $this->conf, true); | ||
683 | $this->assertTrue($updater->updateMethodDownloadSizeAndTimeoutConf()); | ||
684 | $this->assertEquals(4194304, $this->conf->get('general.download_max_size')); | ||
685 | $this->assertEquals(3, $this->conf->get('general.download_timeout')); | ||
686 | } | ||
623 | } | 687 | } |
diff --git a/tests/plugins/test/test.php b/tests/plugins/test/test.php index 3d750c90..2aaf5122 100644 --- a/tests/plugins/test/test.php +++ b/tests/plugins/test/test.php | |||
@@ -11,7 +11,7 @@ function hook_test_random($data) | |||
11 | { | 11 | { |
12 | if (isset($data['_PAGE_']) && $data['_PAGE_'] == 'test') { | 12 | if (isset($data['_PAGE_']) && $data['_PAGE_'] == 'test') { |
13 | $data[1] = 'page test'; | 13 | $data[1] = 'page test'; |
14 | } else if (isset($data['_LOGGEDIN_']) && $data['_LOGGEDIN_'] === true) { | 14 | } elseif (isset($data['_LOGGEDIN_']) && $data['_LOGGEDIN_'] === true) { |
15 | $data[1] = 'loggedin'; | 15 | $data[1] = 'loggedin'; |
16 | } else { | 16 | } else { |
17 | $data[1] = $data[0]; | 17 | $data[1] = $data[0]; |
diff --git a/tpl/vintage/loginform.html b/tpl/vintage/loginform.html index 2c9b710e..0f7d6387 100644 --- a/tpl/vintage/loginform.html +++ b/tpl/vintage/loginform.html | |||
@@ -13,7 +13,7 @@ | |||
13 | {include="page.header"} | 13 | {include="page.header"} |
14 | 14 | ||
15 | <div id="headerform"> | 15 | <div id="headerform"> |
16 | {if="!ban_canLogin($conf)"} | 16 | {if="!$user_can_login"} |
17 | You have been banned from login after too many failed attempts. Try later. | 17 | You have been banned from login after too many failed attempts. Try later. |
18 | {else} | 18 | {else} |
19 | <form method="post" name="loginform"> | 19 | <form method="post" name="loginform"> |