X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=index.php;h=b53b16fefb383400f90eb1b99374b24c907daf68;hb=52964ec8738fcc475604bfd4595a75bdc259e8c5;hp=7da8c22f3562e40446cc7d93468c8a95926f71c8;hpb=6c50a6ccceecf54850e62c312ab2397b84d89ab4;p=github%2Fshaarli%2FShaarli.git diff --git a/index.php b/index.php index 7da8c22f..b53b16fe 100644 --- a/index.php +++ b/index.php @@ -252,7 +252,7 @@ if (isset($_POST['login'])) { // Optional redirect after login: if (isset($_GET['post'])) { - $uri = '?post='. urlencode($_GET['post']); + $uri = './?post='. urlencode($_GET['post']); foreach (array('description', 'source', 'title', 'tags') as $param) { if (!empty($_GET[$param])) { $uri .= '&'.$param.'='.urlencode($_GET[$param]); @@ -263,22 +263,22 @@ if (isset($_POST['login'])) { } if (isset($_GET['edit_link'])) { - header('Location: ?edit_link='. escape($_GET['edit_link'])); + header('Location: ./?edit_link='. escape($_GET['edit_link'])); exit; } if (isset($_POST['returnurl'])) { // Prevent loops over login screen. - if (strpos($_POST['returnurl'], 'do=login') === false) { + if (strpos($_POST['returnurl'], '/login') === false) { header('Location: '. generateLocation($_POST['returnurl'], $_SERVER['HTTP_HOST'])); exit; } } - header('Location: ?'); + header('Location: ./?'); exit; } else { $loginManager->handleFailedLogin($_SERVER); - $redir = '&username='. urlencode($_POST['login']); + $redir = '?username='. urlencode($_POST['login']); if (isset($_GET['post'])) { $redir .= '&post=' . urlencode($_GET['post']); foreach (array('description', 'source', 'title', 'tags') as $param) { @@ -288,7 +288,7 @@ if (isset($_POST['login'])) { } } // Redirect to login screen. - echo ''; + echo ''; exit; } } @@ -659,6 +659,7 @@ function renderPage($conf, $pluginManager, $bookmarkService, $history, $sessionM alphabetical_sort($tags, false, true); + $logMaxCount = $maxcount > 1 ? log($maxcount, 30) : 1; $tagList = array(); foreach ($tags as $key => $value) { if (in_array($key, $filteringTags)) { @@ -666,8 +667,8 @@ function renderPage($conf, $pluginManager, $bookmarkService, $history, $sessionM } // Tag font size scaling: // default 15 and 30 logarithm bases affect scaling, - // 22 and 6 are arbitrary font sizes for max and min sizes. - $size = log($value, 15) / log($maxcount, 30) * 2.2 + 0.8; + // 2.2 and 0.8 are arbitrary font sizes in em. + $size = log($value, 15) / $logMaxCount * 2.2 + 0.8; $tagList[$key] = array( 'count' => $value, 'size' => number_format($size, 2, '.', ''), @@ -923,7 +924,7 @@ function renderPage($conf, $pluginManager, $bookmarkService, $history, $sessionM // Show login screen, then redirect to ?post=... if (isset($_GET['post'])) { header( // Redirect to login page, then back to post link. - 'Location: ?do=login&post='.urlencode($_GET['post']). + 'Location: /login?post='.urlencode($_GET['post']). (!empty($_GET['title'])?'&title='.urlencode($_GET['title']):''). (!empty($_GET['description'])?'&description='.urlencode($_GET['description']):''). (!empty($_GET['tags'])?'&tags='.urlencode($_GET['tags']):''). @@ -934,7 +935,7 @@ function renderPage($conf, $pluginManager, $bookmarkService, $history, $sessionM showLinkList($PAGE, $bookmarkService, $conf, $pluginManager, $loginManager); if (isset($_GET['edit_link'])) { - header('Location: ?do=login&edit_link='. escape($_GET['edit_link'])); + header('Location: /login?edit_link='. escape($_GET['edit_link'])); exit; } @@ -1890,7 +1891,7 @@ function install($conf, $sessionManager, $loginManager) echo ''; + .');document.location=\'./login\';'; exit; }