aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-01-23 20:05:41 +0100
committerArthurHoaro <arthur@hoa.ro>2020-01-26 11:34:14 +0100
commit9e4cc28e2957e1f7df713d52a03e350d728dc58e (patch)
treec659f36c3f483de0cfae30cada7441c9d3e48226 /index.php
parentdd51f653d07dba226fa1088f56ca258ef9b4ae87 (diff)
downloadShaarli-9e4cc28e2957e1f7df713d52a03e350d728dc58e.tar.gz
Shaarli-9e4cc28e2957e1f7df713d52a03e350d728dc58e.tar.zst
Shaarli-9e4cc28e2957e1f7df713d52a03e350d728dc58e.zip
Fix all existing links and redirection to ?do=login
Diffstat (limited to 'index.php')
-rw-r--r--index.php18
1 files changed, 9 insertions, 9 deletions
diff --git a/index.php b/index.php
index 7da8c22f..474d9af5 100644
--- a/index.php
+++ b/index.php
@@ -252,7 +252,7 @@ if (isset($_POST['login'])) {
252 252
253 // Optional redirect after login: 253 // Optional redirect after login:
254 if (isset($_GET['post'])) { 254 if (isset($_GET['post'])) {
255 $uri = '?post='. urlencode($_GET['post']); 255 $uri = './?post='. urlencode($_GET['post']);
256 foreach (array('description', 'source', 'title', 'tags') as $param) { 256 foreach (array('description', 'source', 'title', 'tags') as $param) {
257 if (!empty($_GET[$param])) { 257 if (!empty($_GET[$param])) {
258 $uri .= '&'.$param.'='.urlencode($_GET[$param]); 258 $uri .= '&'.$param.'='.urlencode($_GET[$param]);
@@ -263,22 +263,22 @@ if (isset($_POST['login'])) {
263 } 263 }
264 264
265 if (isset($_GET['edit_link'])) { 265 if (isset($_GET['edit_link'])) {
266 header('Location: ?edit_link='. escape($_GET['edit_link'])); 266 header('Location: ./?edit_link='. escape($_GET['edit_link']));
267 exit; 267 exit;
268 } 268 }
269 269
270 if (isset($_POST['returnurl'])) { 270 if (isset($_POST['returnurl'])) {
271 // Prevent loops over login screen. 271 // Prevent loops over login screen.
272 if (strpos($_POST['returnurl'], 'do=login') === false) { 272 if (strpos($_POST['returnurl'], '/login') === false) {
273 header('Location: '. generateLocation($_POST['returnurl'], $_SERVER['HTTP_HOST'])); 273 header('Location: '. generateLocation($_POST['returnurl'], $_SERVER['HTTP_HOST']));
274 exit; 274 exit;
275 } 275 }
276 } 276 }
277 header('Location: ?'); 277 header('Location: ./?');
278 exit; 278 exit;
279 } else { 279 } else {
280 $loginManager->handleFailedLogin($_SERVER); 280 $loginManager->handleFailedLogin($_SERVER);
281 $redir = '&username='. urlencode($_POST['login']); 281 $redir = '?username='. urlencode($_POST['login']);
282 if (isset($_GET['post'])) { 282 if (isset($_GET['post'])) {
283 $redir .= '&post=' . urlencode($_GET['post']); 283 $redir .= '&post=' . urlencode($_GET['post']);
284 foreach (array('description', 'source', 'title', 'tags') as $param) { 284 foreach (array('description', 'source', 'title', 'tags') as $param) {
@@ -288,7 +288,7 @@ if (isset($_POST['login'])) {
288 } 288 }
289 } 289 }
290 // Redirect to login screen. 290 // Redirect to login screen.
291 echo '<script>alert("'. t("Wrong login/password.") .'");document.location=\'?do=login'.$redir.'\';</script>'; 291 echo '<script>alert("'. t("Wrong login/password.") .'");document.location=\'./login'.$redir.'\';</script>';
292 exit; 292 exit;
293 } 293 }
294} 294}
@@ -923,7 +923,7 @@ function renderPage($conf, $pluginManager, $bookmarkService, $history, $sessionM
923 // Show login screen, then redirect to ?post=... 923 // Show login screen, then redirect to ?post=...
924 if (isset($_GET['post'])) { 924 if (isset($_GET['post'])) {
925 header( // Redirect to login page, then back to post link. 925 header( // Redirect to login page, then back to post link.
926 'Location: ?do=login&post='.urlencode($_GET['post']). 926 'Location: /login?post='.urlencode($_GET['post']).
927 (!empty($_GET['title'])?'&title='.urlencode($_GET['title']):''). 927 (!empty($_GET['title'])?'&title='.urlencode($_GET['title']):'').
928 (!empty($_GET['description'])?'&description='.urlencode($_GET['description']):''). 928 (!empty($_GET['description'])?'&description='.urlencode($_GET['description']):'').
929 (!empty($_GET['tags'])?'&tags='.urlencode($_GET['tags']):''). 929 (!empty($_GET['tags'])?'&tags='.urlencode($_GET['tags']):'').
@@ -934,7 +934,7 @@ function renderPage($conf, $pluginManager, $bookmarkService, $history, $sessionM
934 934
935 showLinkList($PAGE, $bookmarkService, $conf, $pluginManager, $loginManager); 935 showLinkList($PAGE, $bookmarkService, $conf, $pluginManager, $loginManager);
936 if (isset($_GET['edit_link'])) { 936 if (isset($_GET['edit_link'])) {
937 header('Location: ?do=login&edit_link='. escape($_GET['edit_link'])); 937 header('Location: /login?edit_link='. escape($_GET['edit_link']));
938 exit; 938 exit;
939 } 939 }
940 940
@@ -1890,7 +1890,7 @@ function install($conf, $sessionManager, $loginManager)
1890 echo '<script>alert(' 1890 echo '<script>alert('
1891 .'"Shaarli is now configured. ' 1891 .'"Shaarli is now configured. '
1892 .'Please enter your login/password and start shaaring your bookmarks!"' 1892 .'Please enter your login/password and start shaaring your bookmarks!"'
1893 .');document.location=\'?do=login\';</script>'; 1893 .');document.location=\'./login\';</script>';
1894 exit; 1894 exit;
1895 } 1895 }
1896 1896