Browse Source

Fix TINYIB_MANAGEKEY issue

Resolves #194.
shortcut
Trevor Slocum 1 year ago
parent
commit
421503ee01
  1. 6
      imgboard.php
  2. 19
      inc/functions.php

6
imgboard.php

@ -228,7 +228,7 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name'])
fancyDie(__('Posting is currently disabled.<br>Please try again in a few moments.'));
}
list($loggedin, $isadmin) = manageCheckLogIn();
list($loggedin, $isadmin) = manageCheckLogIn(false);
$rawpost = isRawPost();
$rawposttext = '';
if (!$loggedin) {
@ -554,7 +554,7 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name'])
$post = postByID($_POST['delete']);
if ($post) {
list($loggedin, $isadmin) = manageCheckLogIn();
list($loggedin, $isadmin) = manageCheckLogIn(false);
if ($loggedin && $_POST['password'] == '') {
// Redirect to post moderation page
@ -592,7 +592,7 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name'])
die('--&gt; --&gt; --&gt;<meta http-equiv="refresh" content="0;url=imgboard.php">');
}
list($loggedin, $isadmin) = manageCheckLogIn();
list($loggedin, $isadmin) = manageCheckLogIn(true);
if ($loggedin) {
if ($isadmin) {

19
inc/functions.php

@ -335,7 +335,10 @@ function checkMessageSize() {
}
}
function manageCheckLogIn() {
function manageCheckLogIn($requireKey) {
$loggedin = false;
$isadmin = false;
$key = (isset($_GET['manage']) && $_GET['manage'] != '') ? hashData($_GET['manage']) : '';
if ($key == '' && isset($_SESSION['tinyib_key'])) {
$key = $_SESSION['tinyib_key'];
@ -344,11 +347,13 @@ function manageCheckLogIn() {
$_SESSION['tinyib'] = '';
$_SESSION['tinyib_key'] = '';
session_destroy();
fancyDie(__('Invalid key.'));
if ($requireKey) {
fancyDie(__('Invalid key.'));
}
return array($loggedin, $isadmin);
}
$loggedin = false;
$isadmin = false;
if (isset($_POST['managepassword'])) {
checkCAPTCHA(TINYIB_MANAGECAPTCHA);
@ -391,10 +396,8 @@ function setParent() {
function isRawPost() {
if (isset($_POST['rawpost'])) {
list($loggedin, $isadmin) = manageCheckLogIn();
if ($loggedin) {
return true;
}
list($loggedin, $isadmin) = manageCheckLogIn(false);
return $loggedin;
}
return false;

Loading…
Cancel
Save