diff options
-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/Url.php | 2 | ||||
-rw-r--r-- | application/api/controllers/History.php | 4 | ||||
-rw-r--r-- | application/api/controllers/Links.php | 4 | ||||
-rw-r--r-- | docker/alpine/Dockerfile.latest | 2 | ||||
-rw-r--r-- | index.php | 4 | ||||
-rw-r--r-- | tests/plugins/test/test.php | 2 |
9 files changed, 17 insertions, 15 deletions
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/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/docker/alpine/Dockerfile.latest b/docker/alpine/Dockerfile.latest index e9015c13..4724b633 100644 --- a/docker/alpine/Dockerfile.latest +++ b/docker/alpine/Dockerfile.latest | |||
@@ -42,7 +42,9 @@ 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 | VOLUME /var/www/shaarli/data | 46 | VOLUME /var/www/shaarli/data |
47 | |||
46 | EXPOSE 80 | 48 | EXPOSE 80 |
47 | 49 | ||
48 | ENTRYPOINT ["/bin/s6-svscan", "/etc/services.d"] | 50 | ENTRYPOINT ["/bin/s6-svscan", "/etc/services.d"] |
@@ -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'; |
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]; |