Exemple #1
0
<?php

require 'includes/header.php';
force_id();
$erred = false;
$reply = false;
$inserted_id = 0;
$image_data = array();
$authorname = '';
$editing = false;
Check4Ban(true);
if ($_GET['reply']) {
    $reply = true;
    $onload_javascript = 'focusId(\'body\'); init();';
    if (!ctype_digit($_GET['reply'])) {
        add_error('Invalid topic ID.', true);
    }
    $sql = sprintf('SELECT headline, author, replies FROM {P}Topics WHERE id = %d', intval($_GET['reply']));
    $res = DB::Execute($sql);
    if (!$res) {
        $page_title = 'Non-existent topic';
        add_error('There is no such topic. It may have been deleted.', true);
    }
    list($replying_to, $topic_author, $topic_replies) = $res->fields;
    update_activity('replying', $_GET['reply']);
    $page_title = 'New reply in topic: <a href="/topic/' . htmlspecialchars($_GET['reply']) . '">' . htmlspecialchars($replying_to) . '</a>';
    $n = DB::GetOne(sprintf('SELECT COUNT(*) FROM {P}Watchlists WHERE uid =\'%s\'AND topic_id = %d', $_SESSION['UID'], $_GET['reply']));
    if ($n > 0) {
        $watching_topic = true;
    }
} else {
Exemple #2
0
function Check4Filtered($headline, $body, $returnbool = false)
{
    global $ANTIRANDOM, $User;
    $hl_df = defuck_comment($headline);
    $b_df = defuck_comment($body);
    $res = DB::Execute("SELECT filText,filReason,filPunishType,filPunishDuration,filReplacement FROM {P}Filters");
    $dbg = '';
    while (list($fText, $fReason, $fPunishment, $fPunishTime, $fReplacement) = $res->FetchRow()) {
        // Fastest string search method.
        $idx = strpos($hl_df . ' ' . $b_df, $fText);
        if ($idx === false) {
            continue;
        }
        if ($returnbool === true) {
            return true;
        }
        switch ($fPunishment) {
            case 0:
                // Just replace
                $headline = str_ireplace($fText, $fReplacement, $headline);
                $body = str_ireplace($fText, $fReplacement, $body);
                break;
            case 1:
                // 403
                header('HTTP/1.1 403 Forbidden');
                Output::HardError("<b>ATBBS has denied your post, as it contains &quot;" . htmlentities($fText) . "&quot;, which is banned for the following reason:</b><br />{$fReason}");
                break;
            case 2:
                // Ban
                AddBan($User->ID, $_SERVER['REMOTE_ADDR'], $fPunishTime, '<span class="tag filter">Filter</span>' . $fReason, 0);
                break;
            default:
                // Ignore.
                break;
        }
    }
    $score = GetRandomScore($headline . ' ' . $body);
    if ($score >= ANTIRANDOM_MAX_SCORE) {
        if ($returnbool === true) {
            return true;
        }
        header('HTTP/1.1 403 Forbidden');
        Output::HardError("Your post contains random data (Score: {$score}, Max score: " . ANTIRANDOM_MAX_SCORE . "). Knock it the f**k off.");
        exit;
    }
    Check4Ban(true);
    if ($returnbool === true) {
        return false;
    }
    return array($headline, $body);
}
Exemple #3
0
	// Connect to the database.
	DB::Connect();

	if(DB::NeedsUpgrade() && !defined('UPGRADER'))
		Output::HardError('The database engine has determined that the database needs an upgrade.  Please visit <a href="/upgrade/">ATBBS Upgrader</a> to remedy the problem.');
	$User=new User();

	$moderator = $User->isMod();
	$administrator = $User->isAdmin();
	if(!defined('INSTALLER'))
	{
		// Start buffering shit for the template.
		ob_start(); 
	}

	Check4Ban();

	// Dashboard sidebar
	$sidebar=array(
		'User Toolbox' 		=> array(
			array('dashboard/',		'Dashboard',		'Your personal settings, including username and password.'),
			array('edit_ignore_list/',	'Ignore List',		'Edit your personal ignore list, to keep the bad thoughts out.'),
			array('trash_can/',		'Trash',		'Your deleted posts, in an easy-to-access list.')
		),
		'ID Toolbox'		=> array(
			array('restore_ID/',		'Restore ID',		'Similar to logging in.'),
			array('back_up_ID/',		'Back Up ID',		'Save your ID to a portable cardfile.'),
			array('recover_ID_by_email/',	'Email ID',		'Look up your ID by email address.'),
			array('drop_id/',		'Drop ID',		'Log out of '.SITE_TITLE.'.'),
		),
		'Statistics' 		=> array(