/**
 * Look up a quotereply link, and convert it to the necessary anchor
 * tag equivalent if necessary.
 * 
 * @param int $bid The board ID
 * @param string $bfold The board folder name
 * @param int $threadid The (unique) ID for this thread
 * @param int $threadglob The global ID for this thread
 * @param int $pulledvalue The parsed value (i.e. would be 2 for ">>2")
 * 
 * @return string The anchor link (or just ">>$pulledvalue" if it was invalid)
 */
function lookup_qr_link($bid, $bfold, $threadid, $threadglob, $pulledvalue)
{
    $db = new ThornPostDBI();
    // Default to not finding anything of use.
    $link = $link = ">>" . $pulledvalue;
    // This abstracts so much stuff for us.
    $postinfo = $db->getsinglepost($pulledvalue, $bid);
    if ($postinfo != null) {
        if ($postinfo['thread'] == 0) {
            // Just add an anchor tag and go
            if (THuserewrite) {
                $link = '<a href="' . THurl . $bfold . "/thread/" . $pulledvalue . '#' . $pulledvalue . '">&gt;&gt;' . $pulledvalue . "</a>";
            } else {
                $link = '<a href="' . THurl . 'drydock.php?b=' . $bfold . '&amp;i=' . $pulledvalue . '#' . $pulledvalue . '">&gt;&gt;' . $pulledvalue . "</a>";
            }
        } else {
            if ($postinfo['thread'] == $threadid) {
                if (THuserewrite) {
                    $link = "<a href=\"" . THurl . $bfold . "/thread/" . $threadglob . "#" . $pulledvalue . "\">&gt;&gt;" . $pulledvalue . "</a>";
                } else {
                    $link = "<a href=\"" . THurl . 'drydock.php?b=' . $bfold . '&amp;i=' . $threadglob . "#" . $pulledvalue . "\">&gt;&gt;" . $pulledvalue . "</a>";
                }
            } else {
                // We need to look up the global ID.
                $threadinfo = $db->gettinfo($postinfo['thread']);
                // Was it a valid lookup?
                if ($threadinfo != null) {
                    $threadop = $threadinfo['globalid'];
                    if (THuserewrite) {
                        $link = "<a href=\"" . THurl . $bfold . "/thread/" . $threadop . "#" . $pulledvalue . "\">&gt;&gt;" . $pulledvalue . "</a>";
                    } else {
                        $link = "<a href=\"" . THurl . 'drydock.php?b=' . $bfold . '&amp;i=' . $threadop . "#" . $pulledvalue . "\">&gt;&gt;" . $pulledvalue . "</a>";
                    }
                }
            }
        }
    }
    return $link;
}
Beispiel #2
0
 $duration = 0;
 // perma
 $isthread = $postarray['thread'] == 0;
 // thread of 0 means it's a thread
 $db->banipfrompost($postarray['id'], $isthread, 0, $reason, "", $reason, $duration, $_SESSION['username'] . " via mod panel");
 $message = $message . "<br />Banning";
 // Delete, if they're an admin
 if ($_SESSION['admin'] == 1) {
     // Let's assume this is a thread and only change if necessary
     $thread = $postarray['globalid'];
     // thread global ID for cache wiping
     $targetisthread = true;
     $targetid = $postarray['id'];
     // unique ID for post deletion
     if ($postarray['thread'] != 0) {
         $postdbi = new ThornPostDBI();
         $fetched_thread = $postdbi->gettinfo($postarray['thread']);
         $thread = $fetched_thread['globalid'];
         $targetisthread = false;
     }
     smclearcache($board_folder, -1, $thread);
     // clear the associated cache for this thread
     smclearcache($board_folder, -1, -1);
     // AND the board
     delimgs($db->delpost($targetid, $targetisthread));
     // Write to the log
     writelog("delete\tt:" . $postarray['globalid'] . "\tb:" . $postarray['board'], "moderator");
     $message = $message . "<br />Post deletion";
 } else {
     $message = $message . "<br /><i><b>Post deletion failed (insufficient access)</i></b>";
 }
Beispiel #3
0
*/
/*
 //You can see how this would be used (and even expand it to other fields if you wish), but we're not using it right now. - tyam
 if (strlen($_POST['subj'])<3)
 {
 THdie("Subject field not long enough");
 }
*/
$mod = $_SESSION['moderator'] || $_SESSION['admin'];
//quick fix
//var_dump($_POST);
//This should be for CAPTCHA
if (THvc == 1) {
    checkvc();
}
$db = new ThornPostDBI();
if ($db->checkban()) {
    THdie("PObanned");
}
$binfo = $db->getbinfo($db->getboardnumber($_POST['board']));
// Die if the board doesn't exist.
if ($binfo == null) {
    die("Specified board does not exist.");
}
//check for banned keywords
if ($mod == false) {
    // First, flood protection
    $longip = ip2long($_SERVER['REMOTE_ADDR']);
    if ($db->postedwithintime($longip) == true) {
        THdie("You must wait a while before making another post.");
    }
Beispiel #4
0
if (!isset($_GET['post']) || !isset($_GET['board'])) {
    THdie("No post and/or board parameter, nothing to do!");
}
// Get the board ID.
$board_folder = trim($_GET['board']);
// Check for local mod access or global mod/admin access.
if (is_in_csl($board_folder, $_SESSION['mod_array']) != 1 && $_SESSION['admin'] != 1 && $_SESSION['mod_global'] != 1) {
    THdie("You are not permitted to moderate posts on this board");
}
// Initialize admin powers
if (isset($_SESSION["admin"]) && $_SESSION["admin"] == 1) {
    $adminpowers = 1;
} else {
    $adminpowers = 0;
}
$db = new ThornPostDBI();
// Set some stuff up.
$board_id = $db->getboardnumber($board_folder);
$postid = intval($_GET['post']);
// SQL injection protection :]
$threadid = 0;
// set this up later once we get some post data
$ipstring = "";
// Make sure we retrieved a valid board id
if ($board_id == null) {
    THdie("That board does not exist!");
}
// $postarray will hold the assoc containing post data
$postarray = array();
$postarray = $db->getsinglepost($postid, $board_id);
// Make sure it exists
Beispiel #5
0
  $_POST['nombre'] (string for the post name if forced_anon is off)
  $_POST['board'] (for the board id)
  $_POST['password'] (string for post deletion)
 THINGS THAT MIGHT ALSO COME IN:
  $_POST['vc'] (captcha string)
  $_POST['email'] (spambot string)
  $_FILES (for images)
*/
$mod = $_SESSION['moderator'] || $_SESSION['admin'];
//quick fix
//var_dump($_POST);
//This should be for CAPTCHA
if (THvc == 1) {
    checkvc();
}
$db = new ThornPostDBI();
if ($db->checkban()) {
    THdie("PObanned");
}
// Get thread and board info
$thread = $db->gettinfo($_POST['thread']);
$binfo = $db->getbinfo($db->getboardnumber($_POST['board']));
// Die if the board doesn't exist.
if ($binfo == null) {
    die("Specified board does not exist.");
} else {
    if ($thread == null) {
        die("Specified thread does not exist.");
    }
}
//check for banned keywords