コード例 #1
0
require '../../structure/database.php';
require '../../structure/forum.php';
require '../../structure/forum.thread.php';
require '../../structure/base.php';
require '../../structure/user.php';
$database = new database($db_host, $db_name, $db_user, $db_password);
$thread = new thread($database);
$base = new base($database);
$user = new user($database);
$user->updateLastActive();
//useful variables
$username = $user->getUsername($_COOKIE['user'], 2);
$rank = $user->getRank($username);
$id = $_GET['id'];
//take action then log it
if ($thread->checkExistence($id) && $thread->canView($id, $username, $rank) && $rank > 2) {
    $thread_info = $database->processQuery("SELECT `autohiding` FROM `threads` WHERE `id` = ?", array($id), true);
    $database->processQuery("UPDATE `threads` SET `autohiding` = ? WHERE `id` = ?", array($thread_info[0]['autohiding'] == 1 ? 0 : 1, $id), false);
    $base->appendToFile('../logs.txt', array($username . ' toggled the auto-hide of the thread ' . $id));
} else {
    $base->redirect('../viewthread.php?forum=' . $_GET['forum'] . '&id=' . $id . '&goto=start');
}
$redirect = 'http://' . $domain . '/forums/viewthread.php?forum=' . $_GET['forum'] . '&id=' . $id . '&goto=start';
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns:IE>

<!-- LeeStrong Runescape Website Source --!>
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=ISO-8859-1"><!-- /Added by HTTrack -->
<head>
<meta http-equiv="Pragma" content="no-cache">
コード例 #2
0
$forum = new forum($database);
$thread_obj = new thread($database);
$user->updateLastActive();
//make sure required data is in the correct format AND they're logged in
if (!$user->isLoggedIn() || !ctype_digit($_REQUEST['forum']) || !ctype_digit($_REQUEST['id']) || !ctype_digit($_REQUEST['type']) || !ctype_digit($_REQUEST['pid']) && $_REQUEST['type'] == 1) {
    $base->redirect('index.php');
}
//set some variables that are used a lot throughout the page
$username = $user->getUsername($_COOKIE['user'], 2);
$rank = $user->getRank($username);
$f = $_REQUEST['forum'];
$thread = $_REQUEST['id'];
//instead of typing it a million times, we're going to set our redirect url
$redirect = 'viewthread.php?forum=' . $f . '&id=' . $thread;
//make sure they are posting in a forum where they have permission
if ($user->checkMute($username) || !$thread_obj->canView($thread, $username, $rank) || !$thread_obj->canReply($thread, $rank)) {
    $base->redirect($redirect);
}
//extract content for the set type
$data = $_REQUEST['type'] == 1 ? $database->processQuery("SELECT `content`,`username`,`status` FROM `posts` WHERE `id` = ?", array($_REQUEST['pid']), true) : $database->processQuery("SELECT `username`,`content`,`status`,`title` FROM `threads` WHERE `id` = ?", array($thread), true);
//check if they have permission to edit the thread/post
if ($rank < 3 && ($data[0]['username'] != $username || $data[0]['status'] == 1)) {
    $base->redirect($redirect);
}
$type = $_POST['type'];
if ($user->getRank($data[0]['username']) > 3 && $rank < 4) {
    $content = '<div class="frame e">You can\'t edit an administrator\'s post.</div>';
} elseif (isset($_POST['message'])) {
    //send them to their newly editted post
    $url = $type == 1 ? 'viewthread.php?forum=' . $f . '&id=' . $thread . '&goto=' . $_POST['pid'] : 'viewthread.php?forum=' . $f . '&id=' . $thread . '&goto=start';
    if (isset($_POST['cancel'])) {
コード例 #3
0
$base = new base($database);
$user = new user($database);
$forum = new forum($database);
$forum_index = new forum_index($database);
$thread = new thread($database);
$post = new post($database);
$user->updateLastActive();
//get config
$config = $base->loadConfig();
//set some variables that are used a lot throughout the page
$username = $user->getUsername($_COOKIE['user'], 2);
$rank = $user->getRank($username);
$f = $_GET['forum'];
$i = $_GET['id'];
//preform basic checks
if (!ctype_digit($f) || !ctype_digit($i) || !$thread->checkExistence($i) || !$thread->canView($i, $username, $rank)) {
    $base->redirect('index.php');
}
//if the GOTO field is set, let's skip to the selected post
if (ctype_digit($_GET['goto'])) {
    $getPageNum = $thread->getPageNum($_GET['goto'], $i);
    if ($getPageNum) {
        $base->redirect('viewthread.php?forum=' . $f . '&id=' . $i . '&page=' . $getPageNum . '&highlight=' . $_GET['goto'] . '#' . $_GET['goto']);
    }
}
//extract thread details
$detail_query = $database->processQuery("SELECT `id`,`lock`,`sticky`,`title`,`username`,`status`,`content`,`date`,`lastedit`,`qfc`,`moved`,`hidden`,`autohiding` FROM `threads` WHERE `id` = ? LIMIT 1", array($i), true);
//assign data to details[] array
$details['lock'] = $detail_query[0]['lock'];
$details['sticky'] = $detail_query[0]['sticky'];
$details['title'] = stripslashes(htmlentities($detail_query[0]['title']));