diff options
author | nodiscc <nodiscc@gmail.com> | 2014-11-21 18:42:10 +0100 |
---|---|---|
committer | nodiscc <nodiscc@gmail.com> | 2014-11-21 18:42:10 +0100 |
commit | 9bd6089b57bc62b904df47f5105be05a9747d798 (patch) | |
tree | 690c530c4db3b85477c506773ad28e7f21a1cb8e /index.php | |
parent | 4ad88dd190049c27305de6aa7faa1f74e6d5b791 (diff) | |
parent | aedc912d36153b131b3e3bc8a9813c104440aa4b (diff) | |
download | Shaarli-9bd6089b57bc62b904df47f5105be05a9747d798.tar.gz Shaarli-9bd6089b57bc62b904df47f5105be05a9747d798.tar.zst Shaarli-9bd6089b57bc62b904df47f5105be05a9747d798.zip |
Merge pull request #61 from pikzen/shaarli47
Prevents ?do=addlink from generating a 404 if the user is not logged in
Fixes https://github.com/sebsauvage/Shaarli/issues/141
Fixes https://github.com/shaarli/Shaarli/issues/47
Diffstat (limited to 'index.php')
-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'); |