From bee33239ed444f9724422fe5234cd79997500519 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Thu, 23 Jan 2020 22:26:38 +0100 Subject: [PATCH 1/1] Fix all relative link to work with new URL --- application/legacy/LegacyUpdater.php | 4 ++-- assets/common/js/thumbnails-update.js | 2 +- assets/default/js/base.js | 10 +++++----- index.php | 22 +++++++++++----------- tpl/default/changetag.html | 2 +- tpl/default/configure.html | 2 +- tpl/default/daily.html | 6 +++--- tpl/default/import.html | 2 +- tpl/default/includes.html | 2 +- tpl/default/linklist.html | 2 +- tpl/default/page.header.html | 18 +++++++++--------- tpl/default/picwall.html | 2 +- tpl/default/pluginsadmin.html | 4 ++-- tpl/default/tag.list.html | 2 +- tpl/default/tag.sort.html | 8 ++++---- tpl/default/tools.html | 14 +++++++------- tpl/vintage/configure.html | 2 +- tpl/vintage/daily.html | 6 +++--- tpl/vintage/import.html | 2 +- tpl/vintage/includes.html | 2 +- tpl/vintage/page.header.html | 16 ++++++++-------- tpl/vintage/pluginsadmin.html | 4 ++-- tpl/vintage/tools.html | 10 +++++----- 23 files changed, 72 insertions(+), 72 deletions(-) diff --git a/application/legacy/LegacyUpdater.php b/application/legacy/LegacyUpdater.php index 3a5de79f..8d5cd071 100644 --- a/application/legacy/LegacyUpdater.php +++ b/application/legacy/LegacyUpdater.php @@ -10,9 +10,9 @@ use ReflectionMethod; use Shaarli\ApplicationUtils; use Shaarli\Bookmark\Bookmark; use Shaarli\Bookmark\BookmarkArray; -use Shaarli\Bookmark\LinkDB; use Shaarli\Bookmark\BookmarkFilter; use Shaarli\Bookmark\BookmarkIO; +use Shaarli\Bookmark\LinkDB; use Shaarli\Config\ConfigJson; use Shaarli\Config\ConfigManager; use Shaarli\Config\ConfigPhp; @@ -534,7 +534,7 @@ class LegacyUpdater if ($thumbnailsEnabled) { $this->session['warnings'][] = t( - 'You have enabled or changed thumbnails mode. Please synchronize them.' + 'You have enabled or changed thumbnails mode. Please synchronize them.' ); } diff --git a/assets/common/js/thumbnails-update.js b/assets/common/js/thumbnails-update.js index b66ca3ae..060a730e 100644 --- a/assets/common/js/thumbnails-update.js +++ b/assets/common/js/thumbnails-update.js @@ -16,7 +16,7 @@ */ function updateThumb(ids, i, elements) { const xhr = new XMLHttpRequest(); - xhr.open('POST', '?do=ajax_thumb_update'); + xhr.open('POST', './?do=ajax_thumb_update'); xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xhr.responseType = 'json'; xhr.onload = () => { diff --git a/assets/default/js/base.js b/assets/default/js/base.js index d5c29c69..f61cfa92 100644 --- a/assets/default/js/base.js +++ b/assets/default/js/base.js @@ -27,7 +27,7 @@ function findParent(element, tagName, attributes) { */ function refreshToken() { const xhr = new XMLHttpRequest(); - xhr.open('GET', '?do=token'); + xhr.open('GET', './?do=token'); xhr.onload = () => { const token = document.getElementById('token'); token.setAttribute('value', xhr.responseText); @@ -546,7 +546,7 @@ function init(description) { const refreshedToken = document.getElementById('token').value; const fromtag = block.getAttribute('data-tag'); const xhr = new XMLHttpRequest(); - xhr.open('POST', '?do=changetag'); + xhr.open('POST', './?do=changetag'); xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xhr.onload = () => { if (xhr.status !== 200) { @@ -558,8 +558,8 @@ function init(description) { input.setAttribute('value', totag); findParent(input, 'div', { class: 'rename-tag-form' }).style.display = 'none'; block.querySelector('a.tag-link').innerHTML = htmlEntities(totag); - block.querySelector('a.tag-link').setAttribute('href', `?searchtags=${encodeURIComponent(totag)}`); - block.querySelector('a.rename-tag').setAttribute('href', `?do=changetag&fromtag=${encodeURIComponent(totag)}`); + block.querySelector('a.tag-link').setAttribute('href', `./?searchtags=${encodeURIComponent(totag)}`); + block.querySelector('a.rename-tag').setAttribute('href', `./?do=changetag&fromtag=${encodeURIComponent(totag)}`); // Refresh awesomplete values existingTags = existingTags.map(tag => (tag === fromtag ? totag : tag)); @@ -593,7 +593,7 @@ function init(description) { if (confirm(`Are you sure you want to delete the tag "${tag}"?`)) { const xhr = new XMLHttpRequest(); - xhr.open('POST', '?do=changetag'); + xhr.open('POST', './?do=changetag'); xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xhr.onload = () => { block.remove(); diff --git a/index.php b/index.php index b53b16fe..d3cb33d3 100644 --- a/index.php +++ b/index.php @@ -979,7 +979,7 @@ function renderPage($conf, $pluginManager, $bookmarkService, $history, $sessionM if ($oldhash != $conf->get('credentials.hash')) { echo ''; + .'");document.location=\'./?do=changepasswd\';'; exit; } // Save new password @@ -1002,10 +1002,10 @@ function renderPage($conf, $pluginManager, $bookmarkService, $history, $sessionM ); // TODO: do not handle exceptions/errors in JS. - echo ''; + echo ''; exit; } - echo ''; + echo ''; exit; } else { // show the change password form. @@ -1051,7 +1051,7 @@ function renderPage($conf, $pluginManager, $bookmarkService, $history, $sessionM ) { $_SESSION['warnings'][] = t( 'You have enabled or changed thumbnails mode. ' - .'Please synchronize them.' + .'Please synchronize them.' ); } $conf->set('thumbnails.mode', $thumbnailsMode); @@ -1067,10 +1067,10 @@ function renderPage($conf, $pluginManager, $bookmarkService, $history, $sessionM ); // TODO: do not handle exceptions/errors in JS. - echo ''; + echo ''; exit; } - echo ''; + echo ''; exit; } else { // Show the configuration form. @@ -1130,7 +1130,7 @@ function renderPage($conf, $pluginManager, $bookmarkService, $history, $sessionM } $bookmarkService->save(); $delete = empty($_POST['totag']); - $redirect = $delete ? 'do=changetag' : 'searchtags='. urlencode(escape($_POST['totag'])); + $redirect = $delete ? './do=changetag' : 'searchtags='. urlencode(escape($_POST['totag'])); $alert = $delete ? sprintf(t('The tag was removed from %d link.', 'The tag was removed from %d bookmarks.', $count), $count) : sprintf(t('The tag was renamed in %d link.', 'The tag was renamed in %d bookmarks.', $count), $count); @@ -1519,7 +1519,7 @@ function renderPage($conf, $pluginManager, $bookmarkService, $history, $sessionM ), get_max_upload_size(ini_get('post_max_size'), ini_get('upload_max_filesize')) ); - echo ''; + echo ''; exit; } if (! $sessionManager->checkToken($_POST['token'])) { @@ -1532,7 +1532,7 @@ function renderPage($conf, $pluginManager, $bookmarkService, $history, $sessionM $conf, $history ); - echo ''; exit; } @@ -1587,12 +1587,12 @@ function renderPage($conf, $pluginManager, $bookmarkService, $history, $sessionM // TODO: do not handle exceptions/errors in JS. echo ''; exit; } - header('Location: ?do='. Router::$PAGE_PLUGINSADMIN); + header('Location: ./?do='. Router::$PAGE_PLUGINSADMIN); exit; } diff --git a/tpl/default/changetag.html b/tpl/default/changetag.html index ec6e0b46..cc74f786 100644 --- a/tpl/default/changetag.html +++ b/tpl/default/changetag.html @@ -32,7 +32,7 @@ -

{'You can also edit tags in the'|t} {'tag list'|t}.

+

{'You can also edit tags in the'|t} {'tag list'|t}.

{include="page.footer"} diff --git a/tpl/default/configure.html b/tpl/default/configure.html index 8b75900d..9b6a9c46 100644 --- a/tpl/default/configure.html +++ b/tpl/default/configure.html @@ -289,7 +289,7 @@ {if="! $gd_enabled"} {'You need to enable the extension php-gd to use thumbnails.'|t} {elseif="$thumbnails_enabled"} - {'Synchronize thumbnails'|t} + {'Synchronize thumbnails'|t} {/if} diff --git a/tpl/default/daily.html b/tpl/default/daily.html index 6b5103a4..e2e7b47b 100644 --- a/tpl/default/daily.html +++ b/tpl/default/daily.html @@ -11,7 +11,7 @@

{'The Daily Shaarli'|t} - +

@@ -25,7 +25,7 @@
{if="$previousday"} - + {'Previous day'|t} @@ -36,7 +36,7 @@
{if="$nextday"} - + {'Next day'|t} diff --git a/tpl/default/import.html b/tpl/default/import.html index c41afcdb..3d8610f0 100644 --- a/tpl/default/import.html +++ b/tpl/default/import.html @@ -6,7 +6,7 @@ {include="page.header"} -
+
diff --git a/tpl/default/includes.html b/tpl/default/includes.html index 3820a4f7..3e7d6320 100644 --- a/tpl/default/includes.html +++ b/tpl/default/includes.html @@ -17,7 +17,7 @@ {if="is_file('data/user.css')"} {/if} - + {if="! empty($links) && count($links) === 1"} {$link=reset($links)} diff --git a/tpl/default/linklist.html b/tpl/default/linklist.html index ffc236c7..505b1614 100644 --- a/tpl/default/linklist.html +++ b/tpl/default/linklist.html @@ -205,7 +205,7 @@ - diff --git a/tpl/default/page.header.html b/tpl/default/page.header.html index 82f8ebf1..69e2fcd7 100644 --- a/tpl/default/page.header.html +++ b/tpl/default/page.header.html @@ -21,24 +21,24 @@ {if="$is_logged_in || $openshaarli"}
  • - + {'Shaare'|t}
  • - {'Tools'|t} + {'Tools'|t}
  • {/if}
  • - {'Tag cloud'|t} + {'Tag cloud'|t}
  • {if="$thumbnails_enabled"}
  • - {'Picture wall'|t} + {'Picture wall'|t}
  • {/if}
  • - {'Daily'|t} + {'Daily'|t}
  • {loop="$plugins_header.buttons_toolbar"}
  • @@ -52,11 +52,11 @@
  • {/loop}
  • - {'RSS Feed'|t} + {'RSS Feed'|t}
  • {if="$is_logged_in"}
  • - {'Logout'|t} + {'Logout'|t}
  • {else}
  • @@ -74,7 +74,7 @@
  • - +
  • @@ -88,7 +88,7 @@ {else}
  • - +
  • diff --git a/tpl/default/picwall.html b/tpl/default/picwall.html index 73359949..da5101db 100644 --- a/tpl/default/picwall.html +++ b/tpl/default/picwall.html @@ -15,7 +15,7 @@ {if="count($linksToDisplay)===0 && $is_logged_in"}
    - {'There is no cached thumbnail. Try to synchronize them.'|t} + {'There is no cached thumbnail. Try to synchronize them.'|t}
    {/if} diff --git a/tpl/default/pluginsadmin.html b/tpl/default/pluginsadmin.html index 4bfaa934..a017a2ce 100644 --- a/tpl/default/pluginsadmin.html +++ b/tpl/default/pluginsadmin.html @@ -16,7 +16,7 @@
    - +
    @@ -127,7 +127,7 @@ -
    +
    diff --git a/tpl/default/tag.list.html b/tpl/default/tag.list.html index d5777465..dbc5ee3a 100644 --- a/tpl/default/tag.list.html +++ b/tpl/default/tag.list.html @@ -51,7 +51,7 @@
    {if="$is_logged_in===true"}    - + {/if} diff --git a/tpl/default/tag.sort.html b/tpl/default/tag.sort.html index d24c9f64..7af4723d 100644 --- a/tpl/default/tag.sort.html +++ b/tpl/default/tag.sort.html @@ -1,8 +1,8 @@ \ No newline at end of file +
    diff --git a/tpl/default/tools.html b/tpl/default/tools.html index 20d0c893..4a490963 100644 --- a/tpl/default/tools.html +++ b/tpl/default/tools.html @@ -11,35 +11,35 @@

    {'Settings'|t}

    {if="!$openshaarli"} {/if}
    - {'Export database'|t} @@ -47,7 +47,7 @@ {if="$thumbnails_enabled"} diff --git a/tpl/vintage/configure.html b/tpl/vintage/configure.html index 53b0cad2..8d20ea80 100644 --- a/tpl/vintage/configure.html +++ b/tpl/vintage/configure.html @@ -159,7 +159,7 @@ {if="! $gd_enabled"} {'You need to enable the extension php-gd to use thumbnails.'|t} {elseif="$thumbnails_enabled"} - {'Synchonize thumbnails'|t} + {'Synchonize thumbnails'|t} {/if} diff --git a/tpl/vintage/daily.html b/tpl/vintage/daily.html index 00f18e26..4892e0e1 100644 --- a/tpl/vintage/daily.html +++ b/tpl/vintage/daily.html @@ -14,9 +14,9 @@
    All links of one day
    in a single page.
    - {if="$previousday"} <Previous day{else}<Previous day{/if} + {if="$previousday"} <Previous day{else}<Previous day{/if} - - {if="$nextday"}Next day>{else}Next day>{/if} + {if="$nextday"}Next day>{else}Next day>{/if}
    {loop="$daily_about_plugin"} @@ -24,7 +24,7 @@ {/loop}
    - rss_feedDaily RSS Feed + rss_feedDaily RSS Feed
    diff --git a/tpl/vintage/import.html b/tpl/vintage/import.html index bb9e4a56..2ab2cc0a 100644 --- a/tpl/vintage/import.html +++ b/tpl/vintage/import.html @@ -6,7 +6,7 @@ {include="page.header"}
    Import Netscape HTML bookmarks (as exported from Firefox/Chrome/Opera/Delicious/Diigo...) (Max: {$maxfilesize}). - diff --git a/tpl/vintage/includes.html b/tpl/vintage/includes.html index 8d273c44..d77ce497 100644 --- a/tpl/vintage/includes.html +++ b/tpl/vintage/includes.html @@ -14,7 +14,7 @@ {/loop} {if="is_file('data/user.css')"}{/if} - + {if="! empty($links) && count($links) === 1"} {$link=reset($links)} diff --git a/tpl/vintage/page.header.html b/tpl/vintage/page.header.html index a37926d2..f1869a04 100644 --- a/tpl/vintage/page.header.html +++ b/tpl/vintage/page.header.html @@ -18,12 +18,12 @@ {else}
  • Home
  • {if="$is_logged_in"} -
  • Logout
  • -
  • Tools
  • -
  • Add link
  • +
  • Logout
  • +
  • Tools
  • +
  • Add link
  • {elseif="$openshaarli"} -
  • Tools
  • -
  • Add link
  • +
  • Tools
  • +
  • Add link
  • {else}
  • Login
  • {/if} @@ -31,9 +31,9 @@ {if="$showatom"}
  • ATOM Feed
  • {/if} -
  • Tag cloud
  • -
  • Picture wall
  • -
  • Daily
  • +
  • Tag cloud
  • +
  • Picture wall
  • +
  • Daily
  • {loop="$plugins_header.buttons_toolbar"}