diff options
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 12 |
1 files changed, 2 insertions, 10 deletions
@@ -53,6 +53,7 @@ require_once 'application/config/ConfigPlugin.php'; | |||
53 | require_once 'application/FeedBuilder.php'; | 53 | require_once 'application/FeedBuilder.php'; |
54 | require_once 'application/FileUtils.php'; | 54 | require_once 'application/FileUtils.php'; |
55 | require_once 'application/HttpUtils.php'; | 55 | require_once 'application/HttpUtils.php'; |
56 | require_once 'application/Languages.php'; | ||
56 | require_once 'application/LinkDB.php'; | 57 | require_once 'application/LinkDB.php'; |
57 | require_once 'application/LinkFilter.php'; | 58 | require_once 'application/LinkFilter.php'; |
58 | require_once 'application/LinkUtils.php'; | 59 | require_once 'application/LinkUtils.php'; |
@@ -783,8 +784,6 @@ function renderPage($conf, $pluginManager) | |||
783 | if ($targetPage == Router::$PAGE_LOGIN) | 784 | if ($targetPage == Router::$PAGE_LOGIN) |
784 | { | 785 | { |
785 | if ($conf->get('security.open_shaarli')) { header('Location: ?'); exit; } // No need to login for open Shaarli | 786 | if ($conf->get('security.open_shaarli')) { header('Location: ?'); exit; } // No need to login for open Shaarli |
786 | $token=''; if (ban_canLogin($conf)) $token=getToken($conf); // Do not waste token generation if not useful. | ||
787 | $PAGE->assign('token',$token); | ||
788 | if (isset($_GET['username'])) { | 787 | if (isset($_GET['username'])) { |
789 | $PAGE->assign('username', escape($_GET['username'])); | 788 | $PAGE->assign('username', escape($_GET['username'])); |
790 | } | 789 | } |
@@ -1105,7 +1104,6 @@ function renderPage($conf, $pluginManager) | |||
1105 | } | 1104 | } |
1106 | else // show the change password form. | 1105 | else // show the change password form. |
1107 | { | 1106 | { |
1108 | $PAGE->assign('token',getToken($conf)); | ||
1109 | $PAGE->renderPage('changepassword'); | 1107 | $PAGE->renderPage('changepassword'); |
1110 | exit; | 1108 | exit; |
1111 | } | 1109 | } |
@@ -1152,7 +1150,6 @@ function renderPage($conf, $pluginManager) | |||
1152 | } | 1150 | } |
1153 | else // Show the configuration form. | 1151 | else // Show the configuration form. |
1154 | { | 1152 | { |
1155 | $PAGE->assign('token',getToken($conf)); | ||
1156 | $PAGE->assign('title', $conf->get('general.title')); | 1153 | $PAGE->assign('title', $conf->get('general.title')); |
1157 | $PAGE->assign('redirector', $conf->get('redirector.url')); | 1154 | $PAGE->assign('redirector', $conf->get('redirector.url')); |
1158 | list($timezone_form, $timezone_js) = generateTimeZoneForm($conf->get('general.timezone')); | 1155 | list($timezone_form, $timezone_js) = generateTimeZoneForm($conf->get('general.timezone')); |
@@ -1172,7 +1169,6 @@ function renderPage($conf, $pluginManager) | |||
1172 | if ($targetPage == Router::$PAGE_CHANGETAG) | 1169 | if ($targetPage == Router::$PAGE_CHANGETAG) |
1173 | { | 1170 | { |
1174 | if (empty($_POST['fromtag']) || (empty($_POST['totag']) && isset($_POST['renametag']))) { | 1171 | if (empty($_POST['fromtag']) || (empty($_POST['totag']) && isset($_POST['renametag']))) { |
1175 | $PAGE->assign('token', getToken($conf)); | ||
1176 | $PAGE->assign('tags', $LINKSDB->allTags()); | 1172 | $PAGE->assign('tags', $LINKSDB->allTags()); |
1177 | $PAGE->renderPage('changetag'); | 1173 | $PAGE->renderPage('changetag'); |
1178 | exit; | 1174 | exit; |
@@ -1347,7 +1343,6 @@ function renderPage($conf, $pluginManager) | |||
1347 | $data = array( | 1343 | $data = array( |
1348 | 'link' => $link, | 1344 | 'link' => $link, |
1349 | 'link_is_new' => false, | 1345 | 'link_is_new' => false, |
1350 | 'token' => getToken($conf), | ||
1351 | 'http_referer' => (isset($_SERVER['HTTP_REFERER']) ? escape($_SERVER['HTTP_REFERER']) : ''), | 1346 | 'http_referer' => (isset($_SERVER['HTTP_REFERER']) ? escape($_SERVER['HTTP_REFERER']) : ''), |
1352 | 'tags' => $LINKSDB->allTags(), | 1347 | 'tags' => $LINKSDB->allTags(), |
1353 | ); | 1348 | ); |
@@ -1414,11 +1409,10 @@ function renderPage($conf, $pluginManager) | |||
1414 | $data = array( | 1409 | $data = array( |
1415 | 'link' => $link, | 1410 | 'link' => $link, |
1416 | 'link_is_new' => $link_is_new, | 1411 | 'link_is_new' => $link_is_new, |
1417 | 'token' => getToken($conf), // XSRF protection. | ||
1418 | 'http_referer' => (isset($_SERVER['HTTP_REFERER']) ? escape($_SERVER['HTTP_REFERER']) : ''), | 1412 | 'http_referer' => (isset($_SERVER['HTTP_REFERER']) ? escape($_SERVER['HTTP_REFERER']) : ''), |
1419 | 'source' => (isset($_GET['source']) ? $_GET['source'] : ''), | 1413 | 'source' => (isset($_GET['source']) ? $_GET['source'] : ''), |
1420 | 'tags' => $LINKSDB->allTags(), | 1414 | 'tags' => $LINKSDB->allTags(), |
1421 | 'default_private_links' => $conf->get('default_private_links', false), | 1415 | 'default_private_links' => $conf->get('privacy.default_private_links', false), |
1422 | ); | 1416 | ); |
1423 | $pluginManager->executeHooks('render_editlink', $data); | 1417 | $pluginManager->executeHooks('render_editlink', $data); |
1424 | 1418 | ||
@@ -1492,7 +1486,6 @@ function renderPage($conf, $pluginManager) | |||
1492 | // -------- Show upload/import dialog: | 1486 | // -------- Show upload/import dialog: |
1493 | if ($targetPage == Router::$PAGE_IMPORT) | 1487 | if ($targetPage == Router::$PAGE_IMPORT) |
1494 | { | 1488 | { |
1495 | $PAGE->assign('token',getToken($conf)); | ||
1496 | $PAGE->assign('maxfilesize',getMaxFileSize()); | 1489 | $PAGE->assign('maxfilesize',getMaxFileSize()); |
1497 | $PAGE->renderPage('import'); | 1490 | $PAGE->renderPage('import'); |
1498 | exit; | 1491 | exit; |
@@ -1734,7 +1727,6 @@ function buildLinkList($PAGE,$LINKSDB, $conf, $pluginManager) | |||
1734 | 'search_term' => $searchterm, | 1727 | 'search_term' => $searchterm, |
1735 | 'search_tags' => $searchtags, | 1728 | 'search_tags' => $searchtags, |
1736 | 'redirector' => $conf->get('redirector.url'), // Optional redirector URL. | 1729 | 'redirector' => $conf->get('redirector.url'), // Optional redirector URL. |
1737 | 'token' => $token, | ||
1738 | 'links' => $linkDisp, | 1730 | 'links' => $linkDisp, |
1739 | 'tags' => $LINKSDB->allTags(), | 1731 | 'tags' => $LINKSDB->allTags(), |
1740 | ); | 1732 | ); |