diff options
author | Florian Eula <eula.florian@gmail.com> | 2014-11-21 18:31:31 +0100 |
---|---|---|
committer | Florian Eula <eula.florian@gmail.com> | 2014-11-21 18:31:49 +0100 |
commit | aedc912d36153b131b3e3bc8a9813c104440aa4b (patch) | |
tree | 690c530c4db3b85477c506773ad28e7f21a1cb8e | |
parent | 732e683bdacc2033b03820c8e80f7d31c54b94ef (diff) | |
download | Shaarli-aedc912d36153b131b3e3bc8a9813c104440aa4b.tar.gz Shaarli-aedc912d36153b131b3e3bc8a9813c104440aa4b.tar.zst Shaarli-aedc912d36153b131b3e3bc8a9813c104440aa4b.zip |
Prevents ?do=addlink from generating a 404 if the user is not logged in
Fixes https://github.com/shaarli/Shaarli/issue/47
-rw-r--r-- | index.php | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -1349,6 +1349,14 @@ function renderPage() | |||
1349 | header('Location: ?do=login&post='.urlencode($_GET['post']).(!empty($_GET['title'])?'&title='.urlencode($_GET['title']):'').(!empty($_GET['description'])?'&description='.urlencode($_GET['description']):'').(!empty($_GET['source'])?'&source='.urlencode($_GET['source']):'')); // Redirect to login page, then back to post link. | 1349 | header('Location: ?do=login&post='.urlencode($_GET['post']).(!empty($_GET['title'])?'&title='.urlencode($_GET['title']):'').(!empty($_GET['description'])?'&description='.urlencode($_GET['description']):'').(!empty($_GET['source'])?'&source='.urlencode($_GET['source']):'')); // Redirect to login page, then back to post link. |
1350 | exit; | 1350 | exit; |
1351 | } | 1351 | } |
1352 | |||
1353 | // Same case as above except that user tried to access ?do=addlink without being logged in | ||
1354 | // Note: passing empty parameters makes Shaarli generate default URLs and descriptions. | ||
1355 | if (isset($_GET['do']) && $_GET['do'] === 'addlink') { | ||
1356 | header('Location: ?do=login&post='); | ||
1357 | exit; | ||
1358 | } | ||
1359 | |||
1352 | $PAGE = new pageBuilder; | 1360 | $PAGE = new pageBuilder; |
1353 | buildLinkList($PAGE,$LINKSDB); // Compute list of links to display | 1361 | buildLinkList($PAGE,$LINKSDB); // Compute list of links to display |
1354 | $PAGE->renderPage('linklist'); | 1362 | $PAGE->renderPage('linklist'); |