diff options
-rw-r--r-- | application/front/controller/visitor/ShaarliVisitorController.php | 1 | ||||
-rw-r--r-- | application/plugin/PluginManager.php | 1 | ||||
-rw-r--r-- | application/render/PageBuilder.php | 4 | ||||
-rw-r--r-- | doc/md/Server-configuration.md | 16 | ||||
-rw-r--r-- | doc/md/dev/Plugin-system.md | 11 | ||||
-rw-r--r-- | plugins/archiveorg/archiveorg.php | 2 | ||||
-rw-r--r-- | plugins/isso/isso.php | 2 | ||||
-rw-r--r-- | plugins/qrcode/qrcode.php | 2 | ||||
-rw-r--r-- | plugins/wallabag/wallabag.php | 2 | ||||
-rw-r--r-- | tpl/default/daily.html | 2 | ||||
-rw-r--r-- | tpl/default/includes.html | 4 | ||||
-rw-r--r-- | tpl/default/linklist.html | 2 | ||||
-rw-r--r-- | tpl/default/page.footer.html | 4 | ||||
-rw-r--r-- | tpl/default/picwall.html | 2 | ||||
-rw-r--r-- | tpl/default/pluginsadmin.html | 2 |
15 files changed, 41 insertions, 16 deletions
diff --git a/application/front/controller/visitor/ShaarliVisitorController.php b/application/front/controller/visitor/ShaarliVisitorController.php index 55c075a2..54f9fe03 100644 --- a/application/front/controller/visitor/ShaarliVisitorController.php +++ b/application/front/controller/visitor/ShaarliVisitorController.php | |||
@@ -106,6 +106,7 @@ abstract class ShaarliVisitorController | |||
106 | 'target' => $template, | 106 | 'target' => $template, |
107 | 'loggedin' => $this->container->loginManager->isLoggedIn(), | 107 | 'loggedin' => $this->container->loginManager->isLoggedIn(), |
108 | 'basePath' => $this->container->basePath, | 108 | 'basePath' => $this->container->basePath, |
109 | 'rootPath' => preg_replace('#/index\.php$#', '', $this->container->basePath), | ||
109 | 'bookmarkService' => $this->container->bookmarkService | 110 | 'bookmarkService' => $this->container->bookmarkService |
110 | ]; | 111 | ]; |
111 | } | 112 | } |
diff --git a/application/plugin/PluginManager.php b/application/plugin/PluginManager.php index 1b2197c9..da66dea3 100644 --- a/application/plugin/PluginManager.php +++ b/application/plugin/PluginManager.php | |||
@@ -104,6 +104,7 @@ class PluginManager | |||
104 | 'target' => '_PAGE_', | 104 | 'target' => '_PAGE_', |
105 | 'loggedin' => '_LOGGEDIN_', | 105 | 'loggedin' => '_LOGGEDIN_', |
106 | 'basePath' => '_BASE_PATH_', | 106 | 'basePath' => '_BASE_PATH_', |
107 | 'rootPath' => '_ROOT_PATH_', | ||
107 | 'bookmarkService' => '_BOOKMARK_SERVICE_', | 108 | 'bookmarkService' => '_BOOKMARK_SERVICE_', |
108 | ]; | 109 | ]; |
109 | 110 | ||
diff --git a/application/render/PageBuilder.php b/application/render/PageBuilder.php index 41b357dd..2d6d2dbe 100644 --- a/application/render/PageBuilder.php +++ b/application/render/PageBuilder.php | |||
@@ -174,10 +174,12 @@ class PageBuilder | |||
174 | } | 174 | } |
175 | } | 175 | } |
176 | 176 | ||
177 | $rootPath = preg_replace('#/index\.php$#', '', $basePath); | ||
177 | $this->assign('base_path', $basePath); | 178 | $this->assign('base_path', $basePath); |
179 | $this->assign('root_path', $rootPath); | ||
178 | $this->assign( | 180 | $this->assign( |
179 | 'asset_path', | 181 | 'asset_path', |
180 | $basePath . '/' . | 182 | $rootPath . '/' . |
181 | rtrim($this->conf->get('resource.raintpl_tpl', 'tpl'), '/') . '/' . | 183 | rtrim($this->conf->get('resource.raintpl_tpl', 'tpl'), '/') . '/' . |
182 | $this->conf->get('resource.theme', 'default') | 184 | $this->conf->get('resource.theme', 'default') |
183 | ); | 185 | ); |
diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md index 14070c8a..8cb39934 100644 --- a/doc/md/Server-configuration.md +++ b/doc/md/Server-configuration.md | |||
@@ -362,7 +362,23 @@ sudo systemctl reload nginx | |||
362 | 362 | ||
363 | If Shaarli is hosted on a server behind a [reverse proxy](https://en.wikipedia.org/wiki/Reverse_proxy) (i.e. there is a proxy server between clients and the web server hosting Shaarli), configure it accordingly. See [Reverse proxy](Reverse-proxy.md) configuration. | 363 | If Shaarli is hosted on a server behind a [reverse proxy](https://en.wikipedia.org/wiki/Reverse_proxy) (i.e. there is a proxy server between clients and the web server hosting Shaarli), configure it accordingly. See [Reverse proxy](Reverse-proxy.md) configuration. |
364 | 364 | ||
365 | ## Using Shaarli without URL rewriting | ||
365 | 366 | ||
367 | By default, Shaarli uses Slim framework's URL, which requires | ||
368 | URL rewriting. | ||
369 | |||
370 | If you can't use URL rewriting for any reason (not supported by | ||
371 | your web server, shared hosting, etc.), you *can* use Shaarli | ||
372 | without URL rewriting. | ||
373 | |||
374 | You just need to prefix your URL by `/index.php/`. | ||
375 | Example: instead of accessing `https://shaarli.mydomain.org/`, | ||
376 | use `https://shaarli.mydomain.org/index.php/`. | ||
377 | |||
378 | **Recommended:** | ||
379 | * after installation, in the configuration page, set your header link to `/index.php/`. | ||
380 | * in your configuration file `config.json.php` set `general.root_url` to | ||
381 | `https://shaarli.mydomain.org/index.php/`. | ||
366 | 382 | ||
367 | ## Allow import of large browser bookmarks export | 383 | ## Allow import of large browser bookmarks export |
368 | 384 | ||
diff --git a/doc/md/dev/Plugin-system.md b/doc/md/dev/Plugin-system.md index c29774de..f09fadc2 100644 --- a/doc/md/dev/Plugin-system.md +++ b/doc/md/dev/Plugin-system.md | |||
@@ -148,11 +148,16 @@ If a file needs to be included in server end, use simple relative path: | |||
148 | `PluginManager::$PLUGINS_PATH . '/mything/template.html'`. | 148 | `PluginManager::$PLUGINS_PATH . '/mything/template.html'`. |
149 | 149 | ||
150 | If it needs to be included in front end side (e.g. an image), | 150 | If it needs to be included in front end side (e.g. an image), |
151 | the relative path must be prefixed with special data `_BASE_PATH_`: | 151 | the relative path must be prefixed with special data: |
152 | `($data['_BASE_PATH_'] ?? '') . '/' . PluginManager::$PLUGINS_PATH . '/mything/picture.png`. | 152 | |
153 | * if it's a link that will need to be processed by Shaarli, use `_BASE_PATH_`: | ||
154 | for e.g. `$data['_BASE_PATH_'] . '/admin/tools`. | ||
155 | * if you want to include an asset, you need to add the root URL (base path without `/index.php`, for people using Shaarli without URL rewriting), then use `_ROOT_PATH_`: | ||
156 | for e.g | ||
157 | `$['_ROOT_PATH_'] . '/' . PluginManager::$PLUGINS_PATH . '/mything/picture.png`. | ||
153 | 158 | ||
154 | Note that special placeholders for CSS and JS files (respectively `css_files` and `js_files`) are already prefixed | 159 | Note that special placeholders for CSS and JS files (respectively `css_files` and `js_files`) are already prefixed |
155 | with the base path in template files. | 160 | with the root path in template files. |
156 | 161 | ||
157 | ### It's not working! | 162 | ### It's not working! |
158 | 163 | ||
diff --git a/plugins/archiveorg/archiveorg.php b/plugins/archiveorg/archiveorg.php index 922b5966..ed271532 100644 --- a/plugins/archiveorg/archiveorg.php +++ b/plugins/archiveorg/archiveorg.php | |||
@@ -17,7 +17,7 @@ use Shaarli\Plugin\PluginManager; | |||
17 | function hook_archiveorg_render_linklist($data) | 17 | function hook_archiveorg_render_linklist($data) |
18 | { | 18 | { |
19 | $archive_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/archiveorg/archiveorg.html'); | 19 | $archive_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/archiveorg/archiveorg.html'); |
20 | $path = ($data['_BASE_PATH_'] ?? '') . '/' . PluginManager::$PLUGINS_PATH; | 20 | $path = ($data['_ROOT_PATH_'] ?? '') . '/' . PluginManager::$PLUGINS_PATH; |
21 | 21 | ||
22 | foreach ($data['links'] as &$value) { | 22 | foreach ($data['links'] as &$value) { |
23 | $isNote = startsWith($value['real_url'], '/shaare/'); | 23 | $isNote = startsWith($value['real_url'], '/shaare/'); |
diff --git a/plugins/isso/isso.php b/plugins/isso/isso.php index 79e7380b..d4632163 100644 --- a/plugins/isso/isso.php +++ b/plugins/isso/isso.php | |||
@@ -54,7 +54,7 @@ function hook_isso_render_linklist($data, $conf) | |||
54 | if ($conf->get('resource.theme') === 'default') { | 54 | if ($conf->get('resource.theme') === 'default') { |
55 | $button .= '<i class="linklist-plugin-icon fa fa-comment"></i>'; | 55 | $button .= '<i class="linklist-plugin-icon fa fa-comment"></i>'; |
56 | } else { | 56 | } else { |
57 | $button .= '<img class="linklist-plugin-icon" src="plugins/isso/comment.png" '; | 57 | $button .= '<img class="linklist-plugin-icon" src="'. $data['_ROOT_PATH_'].'/plugins/isso/comment.png" '; |
58 | $button .= 'title="Comment on this shaare" alt="Comments" />'; | 58 | $button .= 'title="Comment on this shaare" alt="Comments" />'; |
59 | } | 59 | } |
60 | $button .= '</a></span>'; | 60 | $button .= '</a></span>'; |
diff --git a/plugins/qrcode/qrcode.php b/plugins/qrcode/qrcode.php index 95499e39..24fd18ba 100644 --- a/plugins/qrcode/qrcode.php +++ b/plugins/qrcode/qrcode.php | |||
@@ -19,7 +19,7 @@ function hook_qrcode_render_linklist($data) | |||
19 | { | 19 | { |
20 | $qrcode_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/qrcode/qrcode.html'); | 20 | $qrcode_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/qrcode/qrcode.html'); |
21 | 21 | ||
22 | $path = ($data['_BASE_PATH_'] ?? '') . '/' . PluginManager::$PLUGINS_PATH; | 22 | $path = ($data['_ROOT_PATH_'] ?? '') . '/' . PluginManager::$PLUGINS_PATH; |
23 | foreach ($data['links'] as &$value) { | 23 | foreach ($data['links'] as &$value) { |
24 | $qrcode = sprintf( | 24 | $qrcode = sprintf( |
25 | $qrcode_html, | 25 | $qrcode_html, |
diff --git a/plugins/wallabag/wallabag.php b/plugins/wallabag/wallabag.php index 805c1ad9..d0df3501 100644 --- a/plugins/wallabag/wallabag.php +++ b/plugins/wallabag/wallabag.php | |||
@@ -45,7 +45,7 @@ function hook_wallabag_render_linklist($data, $conf) | |||
45 | $wallabagHtml = file_get_contents(PluginManager::$PLUGINS_PATH . '/wallabag/wallabag.html'); | 45 | $wallabagHtml = file_get_contents(PluginManager::$PLUGINS_PATH . '/wallabag/wallabag.html'); |
46 | 46 | ||
47 | $linkTitle = t('Save to wallabag'); | 47 | $linkTitle = t('Save to wallabag'); |
48 | $path = ($data['_BASE_PATH_'] ?? '') . '/' . PluginManager::$PLUGINS_PATH; | 48 | $path = ($data['_ROOT_PATH_'] ?? '') . '/' . PluginManager::$PLUGINS_PATH; |
49 | 49 | ||
50 | foreach ($data['links'] as &$value) { | 50 | foreach ($data['links'] as &$value) { |
51 | $wallabag = sprintf( | 51 | $wallabag = sprintf( |
diff --git a/tpl/default/daily.html b/tpl/default/daily.html index 3ab8053f..3749bffb 100644 --- a/tpl/default/daily.html +++ b/tpl/default/daily.html | |||
@@ -76,7 +76,7 @@ | |||
76 | </div> | 76 | </div> |
77 | {if="$thumbnails_enabled && !empty($link.thumbnail)"} | 77 | {if="$thumbnails_enabled && !empty($link.thumbnail)"} |
78 | <div class="daily-entry-thumbnail"> | 78 | <div class="daily-entry-thumbnail"> |
79 | <img data-src="{$link.thumbnail}#" class="b-lazy" | 79 | <img data-src="{$root_path}/{$link.thumbnail}#" class="b-lazy" |
80 | src="" | 80 | src="" |
81 | alt="thumbnail" width="{$thumbnails_width}" height="{$thumbnails_height}" /> | 81 | alt="thumbnail" width="{$thumbnails_width}" height="{$thumbnails_height}" /> |
82 | </div> | 82 | </div> |
diff --git a/tpl/default/includes.html b/tpl/default/includes.html index 09768ac4..3e3fb664 100644 --- a/tpl/default/includes.html +++ b/tpl/default/includes.html | |||
@@ -12,10 +12,10 @@ | |||
12 | <link type="text/css" rel="stylesheet" href="{$asset_path}/css/markdown.min.css?v={$version_hash}#" /> | 12 | <link type="text/css" rel="stylesheet" href="{$asset_path}/css/markdown.min.css?v={$version_hash}#" /> |
13 | {/if} | 13 | {/if} |
14 | {loop="$plugins_includes.css_files"} | 14 | {loop="$plugins_includes.css_files"} |
15 | <link type="text/css" rel="stylesheet" href="{$base_path}/{$value}?v={$version_hash}#"/> | 15 | <link type="text/css" rel="stylesheet" href="{$root_path}/{$value}?v={$version_hash}#"/> |
16 | {/loop} | 16 | {/loop} |
17 | {if="is_file('data/user.css')"} | 17 | {if="is_file('data/user.css')"} |
18 | <link type="text/css" rel="stylesheet" href="{$base_path}/data/user.css#" /> | 18 | <link type="text/css" rel="stylesheet" href="{$root_path}/data/user.css#" /> |
19 | {/if} | 19 | {/if} |
20 | <link rel="search" type="application/opensearchdescription+xml" href="{$base_path}/open-search#" | 20 | <link rel="search" type="application/opensearchdescription+xml" href="{$base_path}/open-search#" |
21 | title="Shaarli search - {$shaarlititle}" /> | 21 | title="Shaarli search - {$shaarlititle}" /> |
diff --git a/tpl/default/linklist.html b/tpl/default/linklist.html index b08773d8..e1fb54dd 100644 --- a/tpl/default/linklist.html +++ b/tpl/default/linklist.html | |||
@@ -140,7 +140,7 @@ | |||
140 | <div class="thumbnail"> | 140 | <div class="thumbnail"> |
141 | {ignore}RainTPL hack: put the 2 src on two different line to avoid path replace bug{/ignore} | 141 | {ignore}RainTPL hack: put the 2 src on two different line to avoid path replace bug{/ignore} |
142 | <a href="{$value.real_url}" aria-hidden="true" tabindex="-1"> | 142 | <a href="{$value.real_url}" aria-hidden="true" tabindex="-1"> |
143 | <img data-src="{$base_path}/{$value.thumbnail}#" class="b-lazy" | 143 | <img data-src="{$root_path}/{$value.thumbnail}#" class="b-lazy" |
144 | src="" | 144 | src="" |
145 | alt="" width="{$thumbnails_width}" height="{$thumbnails_height}" /> | 145 | alt="" width="{$thumbnails_width}" height="{$thumbnails_height}" /> |
146 | </a> | 146 | </a> |
diff --git a/tpl/default/page.footer.html b/tpl/default/page.footer.html index 51bdb2f0..ea84aab9 100644 --- a/tpl/default/page.footer.html +++ b/tpl/default/page.footer.html | |||
@@ -10,7 +10,7 @@ | |||
10 | {/if} | 10 | {/if} |
11 | · | 11 | · |
12 | {'The personal, minimalist, super-fast, database free, bookmarking service'|t} {'by the Shaarli community'|t} · | 12 | {'The personal, minimalist, super-fast, database free, bookmarking service'|t} {'by the Shaarli community'|t} · |
13 | <a href="{$base_path}/doc/html/index.html" rel="nofollow">{'Documentation'|t}</a> | 13 | <a href="{$root_path}/doc/html/index.html" rel="nofollow">{'Documentation'|t}</a> |
14 | {loop="$plugins_footer.text"} | 14 | {loop="$plugins_footer.text"} |
15 | {$value} | 15 | {$value} |
16 | {/loop} | 16 | {/loop} |
@@ -25,7 +25,7 @@ | |||
25 | {/loop} | 25 | {/loop} |
26 | 26 | ||
27 | {loop="$plugins_footer.js_files"} | 27 | {loop="$plugins_footer.js_files"} |
28 | <script src="{$base_path}/{$value}#"></script> | 28 | <script src="{$root_path}/{$value}#"></script> |
29 | {/loop} | 29 | {/loop} |
30 | 30 | ||
31 | <div id="js-translations" class="hidden"> | 31 | <div id="js-translations" class="hidden"> |
diff --git a/tpl/default/picwall.html b/tpl/default/picwall.html index b7a56c89..ac613b35 100644 --- a/tpl/default/picwall.html +++ b/tpl/default/picwall.html | |||
@@ -31,7 +31,7 @@ | |||
31 | {loop="$linksToDisplay"} | 31 | {loop="$linksToDisplay"} |
32 | <div class="picwall-pictureframe" role="listitem"> | 32 | <div class="picwall-pictureframe" role="listitem"> |
33 | {ignore}RainTPL hack: put the 2 src on two different line to avoid path replace bug{/ignore} | 33 | {ignore}RainTPL hack: put the 2 src on two different line to avoid path replace bug{/ignore} |
34 | <img data-src="{$value.thumbnail}#" class="b-lazy" | 34 | <img data-src="{$root_path}/{$value.thumbnail}#" class="b-lazy" |
35 | src="" | 35 | src="" |
36 | alt="" width="{$thumbnails_width}" height="{$thumbnails_height}" /> | 36 | alt="" width="{$thumbnails_width}" height="{$thumbnails_height}" /> |
37 | <a href="{$value.real_url}"><span class="info">{$value.title}</span></a> | 37 | <a href="{$value.real_url}"><span class="info">{$value.title}</span></a> |
diff --git a/tpl/default/pluginsadmin.html b/tpl/default/pluginsadmin.html index 05d13556..5c073da6 100644 --- a/tpl/default/pluginsadmin.html +++ b/tpl/default/pluginsadmin.html | |||
@@ -117,7 +117,7 @@ | |||
117 | 117 | ||
118 | <div class="center more"> | 118 | <div class="center more"> |
119 | {"More plugins available"|t} | 119 | {"More plugins available"|t} |
120 | <a href="doc/html/Community-&-Related-software/#third-party-plugins">{"in the documentation"|t}</a>. | 120 | <a href="{$root_path}/doc/html/Community-&-Related-software/#third-party-plugins">{"in the documentation"|t}</a>. |
121 | </div> | 121 | </div> |
122 | <div class="center"> | 122 | <div class="center"> |
123 | <input type="submit" value="{'Save'|t}" name="save"> | 123 | <input type="submit" value="{'Save'|t}" name="save"> |